-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(nuxt): default router scroll behavior #3851
Conversation
β Deploy Preview for nuxt3-docs canceled.
|
@joel-wenzel sorry, your PR got stalled. Can you please consider rebasing it? @posva Can you please confirm if this changes are looking good to you or any change needed? |
Merging this PR would fix the issue nuxt/nuxt#13284 btw |
β¦/scroll-behavior
@pi0 No problem. Rebased. Should be all good now |
@pi0 I merged instead of rebase. If you would rather I make a new branch/PR let me know |
When will it be merged? Current Nuxt 3 page link behaviour is counter-intuitive because page sticks on current position of previous page. Update 2022-06-04:
This might also solve your problems with latest plain Nuxt 3 apps. |
This comment was marked as duplicate.
This comment was marked as duplicate.
The problem of this, at least in content-wind, is that the scroll starts when the next page has yet to be mounted |
Any updates? |
I am waiting until I hear from the core team before fixing merge conflicts. I have fixed them 3 or 4 times now only to become outdated again |
Hi @joel-wenzel. Sorry, it took long on your pull request. I was mainly waiting for @posva's take about the possibility of moving this to the vue-router core. If you can rebase your PR I can locally test and merge to iterate. |
onResolve: () => nuxtApp.callHook('page:finish', routeProps.Component).finally(done) | ||
}, { default: () => h(Component, { key, routeProps, pageKey: key, hasTransition: !!transitionProps } as {}) }) | ||
onResolve: () => { | ||
nextTick(() => nuxtApp.callHook('page:finish', routeProps.Component).finally(done)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heads up @danielroe we are calling page:finish
in nextTick by this PR
Thank you so much for working on this @joel-wenzel and sorry it took long to land! I've made a few refactors and fixes on top of your work. |
Hello @pi0, I've updated to rc.13 today but the scroll behaviour do not work correctly. When I navigate back, the scroll doesn't go to the save position but it's reset instead. |
This should be resolved in the edge channel, or in the next RC. Let me know if not. |
π Linked issue
Discussion #3338
β Type of change
π Description
Added new hook for
page:transition:finish
emitted from NuxtPage. Hook fires after the vue transitionafterLeave
event.Also added default scroll behavior, which can still be overridden by using
app/router.options
π Checklist