-
Notifications
You must be signed in to change notification settings - Fork 689
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
[css-view-transitions-1] Behaviour of the finished
promise
#7956
Comments
So this means that What about animations that are |
There's no concept of 'reverse' for View Transitions. |
Yeah, no such concept right now. There is some discussion on this at #7957 but for now ViewTransitions build on animation primitives which are either active or not. With option 2, when does the
The WA-API doesn't have this problem since it synchronously reaches the end state if you call Maybe an example of how developers would rely on the |
Option 2 does sound better.
That's a good point. I think it's important that
Yes, question is how this API behaves when a user navigates back in mid transition? So that animations are reversed and 'end state' is actually previous view.
It's possible that authors will await the |
That sounds fine. The author could technically wait on both promises in user code but if the common pattern will be to do something after the DOM has been updated and animation finished then resolving after domUpdatedPromise is settled (resolved or rejected) SGTM. @vmpstr @jakearchibald any concerns with this?
For the same-documents script API this is completely in author's control, since the API itself doesn't have a concept of "back navigation":
(1) seems like the nicer default behaviour so maybe it makes sense to add an API to do this automatically. We'd likely also need to do it automatically for MPA. @ydaniv this seems unrelated to this issue. Would it be ok to discuss this on #7957? |
Proposed Resolution: In skip the page transition, the finished promise resolves after the domUpdated resolves, or rejects after the domUpdated rejects (with the same error). |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: [css-view-transitions-1] Behaviour of the finished promise<fantasai> github: https://github.com//issues/7956 <fantasai> JakeA: When you start a view transition, you get an object back that has some promises that you can use to track various things <fantasai> JakeA: one of these is the "finished" promise <fantasai> JakeA: question is, what should happen if the DOM change is successful, but the transition is not? <fantasai> JakeA: transition could not be successful in the case of misconfiguration, e.g. duplicate IDs <fantasai> JakeA: could also mean that transition is abandoned halfway through, because more important transition coming in <fantasai> JakeA: Originally spec would reject unless the transition gets to final frame <fantasai> JakeA: goes through the whole duration of the transition <fantasai> JakeA: Proposing that it finishes whenever it gets to the end state <fantasai> JakeA: we were influenced by animation.finish() <fantasai> JakeA: and animation.finished which will resolve <flackr> +1 <fantasai> JakeA: Desire to change this came after showing them the APIs, and asking them to guess what it would do <fantasai> JakeA: that seemed to be where people were leaning :) <fantasai> Rossen_: +1 for taking the time <fantasai> Rossen_: and alignment with animations is awesome <fantasai> Rossen_: any objections? <bramus> +1 <fantasai> RESOLVED: Accept proposal <fantasai> JakeA: Yes, animation needs to have stopped (even if not completed), and user is looking at new state |
The finished promise should reflect the status of domUpdated if the transition is skipped before animations could finish. See resolution at w3c/csswg-drafts#7956. Change-Id: If340d63587d87237587fc3aa3de98f742d46218e
The finished promise should reflect the status of domUpdated if the transition is skipped before animations could finish. See resolution at w3c/csswg-drafts#7956. Change-Id: If340d63587d87237587fc3aa3de98f742d46218e
The finished promise should reflect the status of domUpdated if the transition is skipped before animations could finish. See resolution at w3c/csswg-drafts#7956. Change-Id: If340d63587d87237587fc3aa3de98f742d46218e
There are two other promises:
domUpdated
- resolves with the promise returned byupdateDOMCallback
.ready
- the transition has successfully prepared, and the pseudo-elements can now be targeted with JavaScript (eg web animation API). It will reject if the transition cannot be ready, either due to misconfiguration, or ifupdateDOMCallback
returns a rejected promise.I see two possible behaviours for
finished
:Option 1: Fulfill on full uninterrupted completion of the transition
If the transition animation does not fully play through,
finished
rejects. This can happen if:updateDOMCallback
rejects - a failed DOM update is not transitionedview-transition-name
, when they're supposed to be unique.Option 2: Fulfill on the 'end state' being visible to the user
The 'end state' being the state after a successful DOM change. This means
finished
will resolve with whatever happens first:finished
will only reject ifupdateDOMCallback
returns a rejected promise. In this case the DOM change failed, so it does not reach a valid end state.I originally spec'd option 1, but I've been convinced on option 2, since this is slower in spirit to
animation.finished
, which will resolve even if the animation is skipped to the end (viaanimation.finish()
).The text was updated successfully, but these errors were encountered: