Repository navigation
Conversation
The Overview/API/Styling/Examples tab nav is sticky at the top of the scroll container, so `scrollIntoView` from the table of contents and fragment links put the target heading underneath it. Give anchor targets in the component viewer a `scroll-margin-top` larger than the tab nav. Fixes angular#34038
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
MannXo
marked this pull request as ready for review
October 31, 2026 09:49
This branch has not been 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.
Summary
Anchor targets on component pages scroll underneath the sticky Overview/API/Styling/Examples tab nav. This gives them a
scroll-margin-topso they land below it.Context
The tab nav (
.docs-component-viewer-tabbed-content.docs-sticky-top) isposition: sticky; top: 0inside the sidenav content, which is the scroll container. Table of contents links and fragment navigation callscrollIntoView(), which aligns the target with the top of that container, so the heading ends up behind the 49px tab bar.Measured on the dialog overview page at 1455x800, after clicking "Keyboard interaction" in the table of contents:
Changes
docs/src/app/pages/component-viewer/component-viewer.scss:scroll-margin-top: 64pxon elements with anidinside.docs-component-viewer-content. That covers headings and example viewers on every tab of a component page. Guide pages have no sticky top bar, so they are left alone.Testing
pnpm stylelint: 0 problems.pnpm ng-dev format changed --check <base>: all files correctly formatted.pnpm ng-dev commit-message validate-range <base> HEAD: valid.sass. The output rule is.docs-component-viewer-content [id] { scroll-margin-top: 64px; }.bazel test //docs/.... Serving the docs locally needs a full Bazel build of the workspace, so the before and after were checked on the deployed site with the compiled rule injected through Playwright.Screenshots
Before
After
Notes for reviewers
scroll-padding-topon.mat-sidenav-content. That would also offset guide pages, which have no sticky bar, so I scoped it to the component viewer.Fixes #34038