Navigating to a new route or different query params does not scroll to top
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.17.0
- Nuxt Version:
3.0.0-rc.13
- Nitro Version:
0.6.1
- Package Manager:
yarn@1.22.19
- Builder:
vite
- User Config:
nitro
- Runtime Modules:
-
- Build Modules:
-
Reproduction
https://github.com/chrisnoden/nuxt3-bug
In short. Create a project with only nuxt rc.13 as a dependency. Create a couple of pages which are longer than the viewable height of the browser. Put links to the pages down below the fold.
Scroll down to click on one of the links. The new page loads but the scroll position is still at the bottom of the page. This is not what anyone expects when navigating to a new “page”. Scroll position should only be controlled by inclusion of a # in the URL typically.
This bug has been around since rc.7 at least.
Describe the bug
The user expects when clicking a link to a new “page” that the page will appear with the scroll position at the top of the page. For example, if you have a long page and click on a link in the footer, you may not notice the page content has changed because you can still only see the footer.
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (3 by maintainers)
Thanks @danielroe – so this would be merged in rc14 or stable?
@richgcook And you can try it out on the edge channel already!