[csswg-drafts] [css-view-transitions-2] [scoped] When we encounter a tag collision, which transition is skipped? (#12323)

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

== [css-view-transitions-2] [scoped] When we encounter a tag collision, which transition is skipped? ==
This issue tracks an open question about the behavior of [Scoped View Transitions](https://github.com/WICG/view-transitions/blob/main/scoped-transitions.md). Further context appears in the document [Self-Participating Scopes](https://bit.ly/svt-sps).

**Q: When we encounter a tag collision, which transition is skipped?**

A "collision" means two transitions wanting to use the same element as a participant.

```
<div id="scope1">
  <div id="scope2">
    <div style="view-transition-name: foo"> PARTICIPANT </div>
  </div>
</div>
<script>
  scope1.startViewTransition(() => { ... });
  scope2.startViewTransition(() => { ... });
</script>
```

When a new transition wants to use an element that is already a participant in an existing transition, we have a few options:
* **first wins** - the new transition is skipped and the existing transition continues to run
* **last wins** - the existing transition is skipped and the new transition begins to run
* **outermost wins** - skip the transition whose scope is deeper in the DOM

@noamr pointed out that the outermost transition is probably more "important" visually.  For example, it is more jarring to skip a whole-page transition than to skip a button transition.  This argues in favor of the "outermost wins" strategy.

Note that this question only matters if a developer fails to set `contain: view-transition` on a scope.  If every potential scope has `contain: view-transition`, then there cannot be any collisions.

cc @noamr @vmpstr @flackr @bramus @jakearchibald 


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


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

Received on Wednesday, 11 June 2025 19:44:22 UTC