Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High page layout shift from network notice despite fix #13

Open
notr1ch opened this issue Sep 16, 2024 · 0 comments
Open

High page layout shift from network notice despite fix #13

notr1ch opened this issue Sep 16, 2024 · 0 comments

Comments

@notr1ch
Copy link

notr1ch commented Sep 16, 2024

#10 tried to resolve an issue where a closed network notice would still appear on page load and later cause a content shift when it was removed once the JS executed. However since ext.networknotice.Notice.js doesn't actually get to execute until most other JS has also loaded via the MediaWiki ResourceLoader, this is too late to solve the issue as the page has already entered the interactive state by then.

I would suggest instead of loading the script via ResourceLoader that the the contents of ext.networknotice.Notice.js are inlined right below the notice HTML to ensure init() properly executes on the interactive event. After minification this script is only 759 bytes and should only appear on pages with the notice so the impact on overall load time should be negligible and the benefits of reducing layout shift should be well worth it.

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

No branches or pull requests

1 participant