-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Make scrollBehavior work with transitions by handling a promise (fixes #1263) #1758
Conversation
Not sure why tests are working locally but not on CI, anyone? |
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.
@homerjam just rerun the tests to ensure it was not something CI end. Looks like it is a consistent failure. Could be something to do with the test implementation.
Could you try something more specific that just a setTimeout. Perhaps use the transition API to hook into when the animation is complete. https://vuejs.org/v2/guide/transitions.html#JavaScript-Hooks
There are events you can hook into, that should give you the desired affect. https://vuejs.org/v2/api/#transition
Hi @blake-newman, I tracked down the test issue to me using async/await which didn't work in phantomjs. Re. the transition API - that was one of my initial thoughts, however by my understanding we're unable to use it programatically from the |
Hey @pi0 any thoughts on this re. how it tackles nuxt/nuxt#1376? |
Although this does not automatically solve the transition problem, it does expose a useful async primitive for users to tackle this problem in userland. |
Will it be documented, how to use this primitive? |
Fix Vue issue vuejs/vue-router#1758 Add html scroll-behavior to smooth to let scroll smoothly. (IE Safari not support this)
As stated in the discussion in #1263 this currently works by enabling an arbitrary delay to be used within the
scrollBehavior
handler. A better solution would use an event handler on the router view or at least allow us to get the transition duration. Unfortunately I don't think this is possible - AFAIK we don't have access to the view from withinscrollBehavior
.