New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent scroll behavior between Router.push and Link #15206
Comments
Sharing a possible workaround here as well for anyone stumbling upon this issue. |
Closing as duplicate of #3249 |
I disagree that this is a duplicate. #3249 is entirely focused on stopping the scroll to the top. I am currently having the issue that I assume the behaviour was changed to always If I'm mistaken and this already exists as an option, my bad! I couldn't find anything in the documentation or any existing issues. EDIT: Nevermind! |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Feature request
Is your feature request related to a problem? Please describe.
I noticed that when using
Link
, you can specify option to prevent scrolling to top but the same option seems missing when usingRouter.push
: https://nextjs.org/docs/api-reference/next/router#routerpush(Additionally, when using browser back buttons, the same scroll behavior happens)
Describe the solution you'd like
A
scroll
option in therouter.push
method to specify whether page should be scrolled to the top or not. This would make the behavior in the method consistent as they are supposed to be parallel methods.Additional context
It seems like here in the code, there needs to be a check for
scroll
:next.js/packages/next/next-server/lib/router/router.ts
Lines 738 to 740 in 23db226
Finally, thank you for all the work that y'all do, and thank you for creating this wonderful library!
The text was updated successfully, but these errors were encountered: