[csswg-drafts] [css-view-transitions-2] [scoped] Are we happy with contain:v-t as the API for tag containment? (#13123)

skobes-chromium has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions-2] [scoped] Are we happy with contain:v-t as the API for tag containment? ==
A goal of [Scoped View Transitions](https://github.com/WICG/view-transitions/blob/main/scoped-transitions.md) is to enable composition: outer and inner components, possibly from different authors or libraries, can both run view transitions at the same time without coordinating with each other or knowing about each other.

This means we need some way to encapsulate `view-transition-name` tags so that each component can choose its own tag names without worrying about conflicts in a shared namespace.

The solution proposed in the explainer (and currently implemented by Chromium) is to support CSS `contain: view-transition` and encourage developers to set this property on elements that will be used as scopes (i.e. that will have `startViewTransition()` called on them).  An outer transition's tag search will not descend into an inner element that has `contain: view-transition`.

This is similar to @flackr's proposal at https://github.com/w3c/csswg-drafts/issues/8915#issuecomment-1883461265 for containing other kinds of named items.

Alternatively, we could have a different API that establishes a containment boundary by declaring that an element will be used as a scope, such as:
* `view-transition-scope: <ident> | none` (@vmpstr floated this idea a long time ago)
* `will-change: view-transition`
* `this-element-will-be-a-view-transition-scope: true`

Alternatively, we could _not_ have any API for this, but I would be opposed to that as explained in https://github.com/w3c/csswg-drafts/issues/12321#issuecomment-3549226635. Applying containment "behind the scenes" during an active view transition is not a sufficient answer, since tags might be picked up by an outer transition before the inner transition starts.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13123 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 19 November 2025 21:21:48 UTC