Skip to content

High page layout shift from network notice despite fix #13

@notr1ch

Description

@notr1ch

#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions