fix(nuxt): scroll to top on dynamic routes with different params #8327
Conversation
Β Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
β Deploy Preview for nuxt3-docs canceled.
|
I've updated to rc.13 and am not seeing that this issue is fixed. Navigating to a fresh "page" and the scroll position does not return to the top of the page. |
It should, can you confirm you don't have a |
I do not have that file. I removed my .nuxt and node_modules before updating to rc.13 and have also updated the @nuxtjs libs. My project works fine in all other respects (so far) but navigating (via NuxtLink) to a fresh page from, eg the footer nav, and the scroll position remains so that the footer is still in view and the actual change to the body can't be seen because it is above the fold. I'll check it on my minimal nuxt project. |
Confirmed. I tested in a bare bones (only nuxt rc.13) project and if my NuxtLink is at the bottom of a long page, clicking it does not cause the browser to scroll to the top. So, this bug is still not resolved. I am unable to get rc6 to run now, but from my perspective this issue started with rc7. LINKED: nuxt/nuxt#14544 |
Same problem. Nested pages scroll to top is not implemented too. |
Here's my minimal project which demonstrates the issue: |
Alright I found the bug, it comes after we removed the transitions by default (PR #8463) cc @danielroe The hooks to wait is To fix that, you can define the |
Resolves a regression from #8463 Learn more in the comments from #8327
Opened a PR to fix this: #8700 Really sorry about the regression π’ |
Thanks for the prompt attention. I can confirm this fixes #8327 (also nuxt/nuxt#15356) |
π Linked issue
β Type of change
π Description
Improvement over #3851 so we scroll to top when it's the same page but with different params.
Example: Going from
/movies/14
to/movies/15
should scroll to top.I am only using params to
/movies
to/movies?q=test
does not scroll to top.π Checklist