fix: stop the navbar shifting when the active link goes bold - #218
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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 active nav link carries
fw-bold, and Open Sans 700 glyphs are wider than 400, so the current page's<li>grows a few pixels and every item after it slides right.The fix mirrors the transparent
border-bottomone rule above it, which already prevents the same shift on the vertical axis: reserve the widest state on every item. Each link now renders an invisible bold copy of its own label via::after, so its width is the bold width in both states.visibility: hiddenis the load-bearing part — it keeps the duplicated text out of the accessibility tree, so the link is still announced once.height: 0alone would hide it from the eye but not from a screen reader.@media (min-width: 992px)block: in the collapsed menu the links stack full-width and there is nothing to shift.Letting the browser measure it avoids hard-coding nine per-item widths, which would drift silently the next time a label is renamed or one is added.
🤖 Generated with Claude Code