Repository navigation
Fix #id targets landing under the sticky header - #2775
Merged
Merged
Conversation
The scroll-margin-top on headings was 5rem (80px) but the desktop header is ~109px with the tabs row, so anchored headings were overlapped. The rule also only covered h1-h6, leaving other #id targets with no offset. Apply the offset to any [id] in .md-typeset: 5rem below 76.25em (header ~61px) and 8rem from 76.25em (header ~109px). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Up to standards ✅🟢 Issues
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
No merge-blocking security or logic issues were identified. Codacy reports the PR is up to standards. The requested behavior should still be covered by automated tests, particularly for responsive heading and non-heading anchors and focus/search behavior.
About this PR
- No automated tests are included for the responsive anchor offsets, non-heading targets, or focus/search behavior. Add coverage for these scenarios before relying on the change.
Test suggestions
- Verify heading anchor targets remain visible below the sticky header below 76.25em.
- Verify heading anchor targets remain visible below the sticky header at or above 76.25em.
- Verify non-heading elements with IDs receive the same responsive offset.
- Verify search or focus behavior is not adversely affected by page-wide scroll padding.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify heading anchor targets remain visible below the sticky header below 76.25em.
2. Verify heading anchor targets remain visible below the sticky header at or above 76.25em.
3. Verify non-heading elements with IDs receive the same responsive offset.
4. Verify search or focus behavior is not adversely affected by page-wide scroll padding.
Low confidence findings
- The PR does not report a successful strict build; verify the build in an environment with initialized submodules before merging.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
claudiacodacy
enabled auto-merge (squash)
October 6, 2026 08:26
manufacturist
approved these changes
Oct 6, 2026
This branch was previously deployed
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.
Problem
Opening a page with a
#idin the URL often leaves the target hidden under the navbar (reported by Ioan in Slack). Example:/codacy-ai/codacy-ai/#ai-featuresput the heading at 93px while the header is 109px tall.Cause
scroll-margin-topon headings was5rem(80px), but the desktop header is ~109px because the tabs row is part of it.h1–h6, so other#idtargets got no offset.Change
theme/stylesheets/content.css: applyscroll-margin-topto.md-typeset [id]:5rembelow 76.25em (header ~61px),8remfrom 76.25em (header ~109px). Both leave ~19px of clearance.theme/stylesheets/base.css: update the comment that referred to headings only.scroll-padding-topon<html>, per the existing comment (it caused a scroll jump when opening search).Verified
Injected the same CSS into docs.codacy.com at 1280px and 600px wide on
/codacy-ai/codacy-ai/#ai-features: 19px clearance at both widths.Not verified
mkdocs build --strict(submodules not initialised in my worktree)#idtarget🤖 Generated with Claude Code