← Back to release summary

ViewTransitions waitUntil() method

Category
Miscellaneous
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

The ViewTransition automatically constructs a pseudo-element tree to display and animate participating elements in the transition. Per spec, this subtree is constructed when the view transition starts animating and is destroyed when the animations associated with all view transition pseudo-elements are in the finished state (or more precisely in a non-running non-paused state). This works for a vast majority of cases and provides a seamless experience for the developers. However, for more advanced cases, this is insufficient as there are times when developers want the view transition pseudo-tree to persist beyond the animation finish state. One example is tying view transitions with Scroll Driven Animations. When the animation is controlled by a scroll timeline, we don't want the subtree to be destroyed when the animations finish since scrolling back should still be able to animate the pseudo elements. In order to enable advanced uses of view transition, this intent adds a waitUntil() function on the ViewTransition object which takes a promise. This promise then delays destruction of the pseudo-tree until it is settled.

Standards & signals

Explainers: https://github.com/vmpstr/htmldemos/blob/master/vt/waitUntil.md

View on chromestatus.com