Skip to content

Next.js sticky scroll standards#90197

Draft
feedthejim wants to merge 1 commit intocanaryfrom
cursor/next-js-sticky-scroll-standards-8c23
Draft

Next.js sticky scroll standards#90197
feedthejim wants to merge 1 commit intocanaryfrom
cursor/next-js-sticky-scroll-standards-8c23

Conversation

@feedthejim
Copy link
Contributor

What?

Adds documentation for handling sticky headers with Next.js navigation using scroll-padding-top.

Why?

Next.js's auto-scroll behavior explicitly skips sticky and fixed positioned elements. This can cause content to appear behind sticky headers when navigating to a hash fragment or using the scroll prop on Link. This documentation provides a web-standards solution using CSS scroll-padding-top to correctly position the scroll target.

How?

  • Added a new "Handling sticky headers with scroll-padding-top" subsection to the Link component API reference (docs/01-app/03-api-reference/02-components/link.mdx) under the scroll prop.
  • Added a new "Scrolling with sticky headers" example to the "Linking and Navigating" guide (docs/01-app/01-getting-started/04-linking-and-navigating.mdx).

Slack Thread

Open in Cursor Open in Web

Document how to use the CSS scroll-padding-top property to handle
sticky/fixed headers with Next.js auto-scroll behavior on navigation.

Next.js skips sticky and fixed positioned elements when scrolling to
new content during client-side navigation. This can cause content to
appear behind a sticky header. The scroll-padding-top CSS property on
the scroll container (html) offsets scroll positioning to account for
the sticky element's height.

Added to:
- Link component API reference (scroll prop section)
- Linking and Navigating getting started page (examples section)

Co-authored-by: Jimmy Lai <hello@jimmyl.ai>
@cursor
Copy link

cursor bot commented Feb 19, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@nextjs-bot nextjs-bot added created-by: Next.js team PRs by the Next.js team. Documentation Related to Next.js' official documentation. labels Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by: Next.js team PRs by the Next.js team. Documentation Related to Next.js' official documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments