Navbar hides initial content when jumping to in-page anchor
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 175k
- Forks
- 78.6k
- Avg merge
- 7h 19m
- Merged PRs (30d)
- 35
Description
Prerequisites
- I have searched for duplicate or closed issues
- I have validated any HTML to avoid common problems
- I have read the contributing guidelines
Describe the issue
This issue was already reported and locked at #1768.
Basically, when you jump to an in-page anchor, the target is displayed behind the navbar.
A fix (using scroll-margin-top) was suggested in passing at https://github.com/twbs/bootstrap/pull/30273#issuecomment-598609487
Is it worth adding some docs to the Navbar section, to recommend adding a custom rule like
[id] {
scroll-margin-top: <your navbar height here>;
}
Or is a more general fix possible ?
Reduced test cases
https://codepen.io/forthadena/pen/oNoMwQd
What operating system(s) are you seeing the problem on?
Windows, macOS, Android, iOS, Linux
What browser(s) are you seeing the problem on?
Chrome, Safari, Firefox
What version of Bootstrap are you using?
5.1.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodePen reduced test case and the Navbar section referenced in the issue. Compare anchor-jump behavior across the listed browsers and determine whether the appropriate outcome is a general fix or documented guidance; done means the target content is no longer obscured, or the Navbar documentation clearly explains the supported workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100