App Router: Link component is not respecting scroll-behavior: smooth when only hash changes. #54240
Closed
1 task done
Labels
bug
Issue was opened via the bug report template.
locked
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 Binaries: Node: 16.15.1 npm: 8.11.0 Yarn: 1.22.19 pnpm: 8.6.11 Relevant Packages: next: 13.4.18-canary.0 eslint-config-next: 13.4.18-canary.0 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.6 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router, Routing (next/router, next/navigation, next/link)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/coreyleelarson/scroll-behavior-smooth
To Reproduce
Toggle between the different nav links to observe the difference in behavior between the anchors and Link components.
Describe the Bug
Link component is not respecting
scroll-behavior: smooth
when only hash changes. If I append!important
it works, but that should not be required.There was a previous bug report for this (#51721) but the linked fix does not appear to resolve the issue in the latest version.
Expected Behavior
Link component should scroll smoothly to the target anchor when
scroll-behavior: smooth
is set without!important
.Which browser are you using? (if relevant)
Chrome 116.0.5845.96
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: