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

fix(main.blade.php): use alternative solution for minimizing layout shift #1689

Merged
merged 3 commits into from
Jul 23, 2023

Conversation

wescopeland
Copy link
Member

This PR removes max-width in favor of swapping the position of the <article> and <aside> tags in the template. This has the benefit of remediating layout shift on the home page while also getting fluid layouts to work (/demo).

Why this works
The layout shift on the home page is caused by the Active Players widget's <script> tag, which the browser loads synchronously. During loading, HTML parsing is blocked and the browser renders the content available in that frame, which just happens to be missing the right-hand column. This is what is causing the layout shift on the home page.

This solution remediates the issue by forcing the browser to parse the right-hand column first.

@wescopeland wescopeland requested a review from luchaos July 23, 2023 14:37
Copy link
Member

@luchaos luchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic 👏

@luchaos luchaos merged commit 01c48db into RetroAchievements:master Jul 23, 2023
5 checks passed
@wescopeland wescopeland deleted the layout-shift-02 branch July 23, 2023 19:16
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