-
Notifications
You must be signed in to change notification settings - Fork 71
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
feat: add API to pause scroll position saving #306
Conversation
I'm really sorry for the delay here. We've been swamped at work lately. I'll take a look by early next week. Unfortunately probably not this weekend |
No problem, thanks for you help so far - I'll be grateful if you can have a look soon. I'd like to make the tests cover his change but it looks like that would require a bit of surgery on he test setup - to make it call |
can you merge with master to avoid the conflicts with your other PR? |
9d238b0
to
52e719f
Compare
conflict fixed |
any chance of getting to this soon? |
52e719f
to
804f14d
Compare
sorry, i've been really swamped. i'll look by end of week |
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.
apologies for the delay here
Besides implementing your suggestion for the API, I also added tests (which was easier with this API), and in the process fixed a bug that prevented this feature from working for custom elements. I think it's ready now. |
published to v0.9.11 |
thanks for your help here – sorry for the delay |
No worries, thankyou! |
Now that taion/scroll-behavior#306 has been merged, this updates the dependency to the released version, including using the modified API that resulted from the review feedback. Fixes #69
In Rudy it is possible that
updateScroll
is not called immediately after a transition (rather it might occur asynchronously afterwards).Further, the content of the new route might not be rendered immediately. for example, the following things might happen
updateScroll
is called to restore the scroll position on the new routeSometimes, scroll events happen at steps 3 or 5, because the page content height reduces such that it is lower than the current
window.scrollY
value. In this case, it is not desired to save the scroll position, because it is just noise occurring during the transition.This adds a flag
_isTransitioning
which is used to skip saving the scroll position in between calls to the transition hook andupdateScroll
. The assumption is thatupdateScroll
is always called after every transition.