- From: Jake Archibald via GitHub <sysbot+gh@w3.org>
- Date: Wed, 26 Oct 2022 08:53:13 +0000
- To: public-css-archive@w3.org
jakearchibald has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-view-transitions-1] Behaviour of the `finished` promise == ```js const transition = document.createViewTransition(updateDOMCallback); await transition.finished; ``` There are two other promises: - `ready` - the transition has successfully prepared, and the pseudo-elements can now be targeted with JavaScript (eg web animation API). - `domUpdated` - resolves with the promise returned by `updateDOMCallback` `ready` will reject if `updateDOMCallback` rejects. There are two possible behaviours for `finished`: ## Option 1: 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 transitioned - A misconfiguration means that, although the DOM successfully updated, a transition cannot be performed. For example, multiple elements have the same `view-transition-name`, when they're supposed to be unique. - The transition is aborted due to a newer transition. ## Option 2: 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: - The transition plays through to completion - The transition is aborted, so it visually appears to skip to the end `finished` will only reject if `updateDOMCallback` rejects. In this case the DOM change failed, so it does not reach a finished 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 (via `animation.finish()`). Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7956 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 26 October 2022 08:53:15 UTC