-
Notifications
You must be signed in to change notification settings - Fork 51
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
Enable modifying the transition based on incoming state (SPA/MPA) #25
Comments
I created some quick examples to illustrate the problem, and some possible solutions. Unfortunately, Chrome seems to have some timing bugs in web animations that occasionally break the demos, but it's solid in Firefox https://static-misc-2.glitch.me/page-transition/. (it's totally broken in Safari) |
I'm trying to narrow down the feature request based on the examples in the comment above. We need an animation for the header and I don't think that needs to a paired transition. It closely aligns with the feature request in #37, we want a separate entry/exit slide animation for the header. The idea of a single element transition that we've discussed should cover this. An excellent use-case this brings up is whether the transition should be modifiable based on the scroll offset. And I think this could be a general pattern of handling back navigations where the restored page was modified because of user interaction. This is how we got to the discussion of whether the incoming or outgoing page should decide the transition (@vmpstr fyi):
The 2) scenario is what makes me inclined towards having an API which lets the incoming page decide the transition. |
The rough sketch for the MPA API is here. And we agree that state on both pages is relevant for deciding the transitions. The outgoing one tags based on its current state and can include opaque context data. The incoming one receives this data and decides the transition based on its own state. |
One thing I've had trouble figuring out in the past is what to do with shared elements across two documents when scroll position is different between the two.
For instance:
page-2/#footer
, which targets the bottom of the document.Should the header try to do a shared transition in this case? I think it'd look weird.
What if:
page-2/
, which loads scrolled to the very top.In this case the header is in-viewport in both cases. I am not a designer (IANAD?) but it feels like animating scroll position is the most natural thing here.
Let me know if it isn't clear & I'll come up with some animated examples.
The text was updated successfully, but these errors were encountered: