Skip to content

Conversation

@thet
Copy link
Member

@thet thet commented Dec 21, 2022

Include the modernizr bundle by injecting a script tag. This ensures modernizr is loaded synchronously and executing early and sets it's feature detection classes before the layout is done by the browser.

This reverts the breaking change from the previous Patternslib 9.8.0-beta.2 release. The separate modernizr.min.js build file is still kept, but modernizr is included by the main Patternslib bundle. There is no need to add another script tag to include modernizr.

You can disable loading of modernizr by setting the following before the Patternslib bundle.min.js is included:

<script>window.__patternslib_disable_modernizr = true;</script>

Since Patternslib 9.0.0-alpha.0 where we introduced webpack module federation for our bundles, Modernizr is loaded asynchronously and applying it's CSS classes a tick too late. For example, the change from the no-js to the js class was done while the tiles have already been drawn and visible on the screen, resulting in screen flickering. There are a number of projects which depend on Modernizr being applied early.

@thet thet force-pushed the modernizr-load branch 2 times, most recently from 1051d12 to 263a337 Compare December 21, 2022 19:11
thet added 4 commits December 22, 2022 13:24
Include the modernizr bundle by injecting a script tag. This ensures
modernizr is loaded synchronously and executing early and sets it's
feature detection classes before the layout is done by the browser.

This reverts the breaking change from the previous Patternslib 9.8.0-beta.2
release. The separate modernizr.min.js build file is still kept, but
modernizr is included by the main Patternslib bundle. There is no need
to add another script tag to include modernizr.

You can disable loading of modernizr by setting the following before the
Patternslib bundle.min.js is included:

<script>window.__patternslib_disable_modernizr = true;</script>

Also, the "js" class is set on the HTML root tag when a "no-js" class
was present regardless of the "__patternslib_disable_modernizr" setting.

Since Patternslib 9.0.0-alpha.0 where we introduced webpack module
federation for our bundles, Modernizr is loaded asynchronously and
applying it's CSS classes a tick too late. For example, the change from
the "no-js" to the "js" class was done while the tiles have already been
drawn and visible on the screen, resulting in screen flickering. There
are a number of projects which depend on Modernizr being applied early.
jQuery is now imported and set earlier.
@thet thet merged commit 7197d37 into master Dec 22, 2022
@thet thet deleted the modernizr-load branch December 22, 2022 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants