You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Virtually, window would be scrolled to top immediately by <ScrollRestoration /> after location changed. Since all content in html share the same window.scrollY. The scroll-to-top behavior and the animate-{outlet} are happening at same time.
I thought I can capture the end of first {outlet} exit animation by onAnimationComplete and only then "continue" to do scroll-to-top. But re-implementing <ScrollRestoration /> for this one means a lot to me. I may break something I don't even aware of.
The Problem
It's might be too rough to framer-route-animation example that it's not considering scroll-to-top behavior by
<ScrollRestoration />
.bandicam.2024-03-13.10-07-49-128.mp4
About the Causes
Virtually, window would be scrolled to top immediately by
<ScrollRestoration />
after location changed. Since all content in html share the samewindow.scrollY
. The scroll-to-top behavior and the animate-{outlet}
are happening at same time.I thought I can capture the end of first
{outlet}
exit animation byonAnimationComplete
and only then "continue" to do scroll-to-top. But re-implementing<ScrollRestoration />
for this one means a lot to me. I may break something I don't even aware of.We can use
useBlocker
to stop navigation and continue ononAnimationComplete
. But it might not be ideal as:Code
It's a modified version from framer-route-animation example.
The only relevant change is add padding to make page scrollable. I also apply a background for visualize the problem better.
codesandbox here:
https://codesandbox.io/p/devbox/remix-example-framer-route-animation-bug-9npqvc?file=%2Fapp%2Froot.tsx%3A30%2C6
The text was updated successfully, but these errors were encountered: