Open mitchuman opened 1 year ago
Now realizing this is the same issue as https://github.com/vercel/next.js/issues/49612
having the same issue, scroll padding and scroll margin doesn't seem to work when trying to navigate to anchor links for headers.
I have the same issue.
Facing the very same issue here 😬 using Next.js 14.0.3
Issue still persists, don’t think it was ever fixed in next.js 13
still in 14.2.2 ...
Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!
Need this to make a clean website
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Routing (next/router, next/navigation, next/link)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/mitchuman/scroll-margin-issue
To Reproduce
Demo: https://scroll-margin-issue.vercel.app/
Compare
<Link>
and<a>
with anchor/jump links (href="#..."
) that jump to elements with CSSscroll-margin-*
Describe the Bug
Elements jumped to with
<Link>
components don't have thescroll-margin-*
applied.scroll-behavior: smooth
also does not work for only for<Link>
components.:target
selector also is not activated when viewed in devtools.Expected Behavior
<a>
tags work as expected where elements are scroll with the margin applied.Which browser are you using? (if relevant)
Firefox Developer 115.0b3 (64-bit), Arc 0.107.0 (39372), Safari 15.4 (17613.1.17.1.13)
How are you deploying your application? (if relevant)
Vercel