Skip to content

website: reserve room for the fixed navbar when scrolling to an anchor - #4462

Open
opensource-joe wants to merge 1 commit into
kubeflow:masterfrom
opensource-joe:fix/scroll-padding-fixed-navbar
Open

opensource-joe wants to merge 1 commit into
kubeflow:masterfrom
opensource-joe:fix/scroll-padding-fixed-navbar

Conversation

@opensource-joe

Copy link
Copy Markdown

Description of Changes

.td-navbar is position: fixed from the md breakpoint up, and nothing compensated for it, so following any in-page anchor scrolled the target heading underneath the navbar.

One declaration in assets/scss/_variables_project.scss, next to the existing html.smooth-scroll rule, scoped to the same breakpoint at which the navbar becomes fixed.

Measured on /docs/started/introduction/#what-is-kubeflow, before and after:

Viewport Navbar Heading top, before after
1920 fixed, 106px 0.2px (covered) 125.2px
1280 fixed, 106px 0.2px (covered) 125.2px
992 fixed, 106px 0.2px (covered) 125.2px
768 fixed, 109px 0.2px (covered) 125.2px
375 not fixed 0.2px (fine) unchanged

Also checked the table of contents path from the issue: clicking "Why Kubeflow Pipelines?" on /docs/components/pipelines/overview/ now lands the heading at 125.2px instead of 0.2px.

Two notes for reviewers:

  • The rule is scoped to min-width: 768px because the navbar is only fixed there. Below that it scrolls away with the page and needs no compensation, so an unscoped rule would add dead space on mobile.
  • It has to live in _variables_project.scss. _docsy_main.scss and _styles_project.scss are imported inside the [data-theme=...] blocks in main.scss, so an html rule in either would compile to [data-theme=light] html and never match. That file is imported before Bootstrap's mixins, hence the written-out breakpoint instead of media-breakpoint-up(md).

Tested against a local build at 476e4c1 with Hugo extended 0.124.1, the version pinned in netlify.toml. hugo --gc --minify builds clean.

Related Issues

Closes: #4460

Checklist

The navbar is position: fixed from the md breakpoint up, and nothing
compensated for it, so following an in-page anchor or a table of contents
entry put the target heading underneath it.

Closes: kubeflow#4460
Signed-off-by: Joe Castle <joecastleengineering@gmail.com>
@google-oss-prow google-oss-prow Bot added the area/website AREA: Website Styles/Hosting/Serving label Aug 21, 2026
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zijianjoy for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
google-oss-prow Bot requested a review from varodrig August 21, 2026 19:19
@google-oss-prow

Copy link
Copy Markdown

Hi @opensource-joe. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@github-actions

Copy link
Copy Markdown

🚫 This command cannot be processed. Only organization members or owners can use the commands.

@Arhell Arhell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/website AREA: Website Styles/Hosting/Serving lgtm ok-to-test size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(website): in-page anchors land behind the fixed navbar

4 participants