Repository navigation
Clear the navbar when jumping to a subsection on wide screens - #22
Merged
Merged
Conversation
The theme's hideOnScroll gives anchors only 0.5rem of scroll margin, expecting the navbar to slide away. On the wide layout we keep the navbar in place, so h3–h6 targets landed beneath it. Give them the sticky-navbar margin there; h2s keep their own rule that aligns with the hairline. Co-Authored-By: Claude Opus 5.5 <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.
On a wide screen, a link to a subsection (h3–h6, like
#profileon the working draft) scrolled the heading under the navbar.Why. The site turns on the theme's
navbar.hideOnScroll. With it on, the theme gives every anchor only0.5remofscroll-margin-top, because it expects the navbar to slide away. On the wide layout we override that and keep the navbar in place (transform: noneabove 996px), so the heading lands beneath it. h2s were already fine because they have their own rule that puts their top rule on the navbar's hairline.Change. Above 996px, anchors other than h2 get the sticky-navbar margin,
--ifm-navbar-height + 0.5rem. The selector carries:not(h2)for two reasons: it leaves the h2 rule alone, and it beats the theme's rule, which has the same specificity and loads aftercustom.css.Checked in
docusaurus start:#profile(h3) and#payload-contract(h4) land 9px below the navbar instead of under it.#concepts(h2) still lines up with the hairline.0.5rem, since the navbar hides there.🤖 Generated with Claude Code