Repository navigation
docs: stop the header shifting on page load - #1544
Merged
Merged
Conversation
- Keep the downloads badge a fixed width while it counts up: the count stays in its final unit and sits over a hidden copy of the final value. - Self-host the fonts with Astro's fonts API (metric-matched fallbacks, preloads for the header and hero faces) instead of Google Fonts CSS. - Hold Chrome's first paint until the whole header is parsed, so the search box no longer paints at the right edge before the pills exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
🚀 PR was released in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docs header jiggled on load. Measured with Playwright's layout-shift observer, there were three causes:
120K…4.5M), so the badge's width changed every frame and pushed the search box, GitHub pill and theme switch back and forth for about 1.4s. It now counts in the final unit (0.0M→4.5M) over a hidden copy of the final value, so its width never changes.Head.astronow adds<link rel="expect" href="#header-end" blocking="render">, which holds the first paint until the end of the header is parsed. Browsers that don't support it ignore it.What's left is one small settle when the webfonts replace their fallbacks (CLS about 0.0005; the nav is about 20px narrower in Fredoka than in its Arial fallback). That's well below the 0.1 "good" threshold, and it happens once instead of throughout the count-up.
Checked on
/,/methods/blur/,/guides/getting-started/and/playground/. The production build passes (230 pages).🤖 Generated with Claude Code