Re: [csswg-drafts] [css-view-transitions-1] Can we make the `::view-transition-old` and `::view-transition-new` pseudos “:has-allowed pseudo-element”s? (#12630)

One complication is that the selectors for the VT pseudos are attached to the scope element, instead of the regular parent relationship

From https://drafts.csswg.org/css-view-transitions-1/#view-transition-pseudos:
> All of the [view transition pseudo-elements](https://drafts.csswg.org/css-view-transitions-1/#view-transition-pseudo-elements) are selected from their [ultimate originating element](https://drafts.csswg.org/selectors-4/#ultimate-originating-element), the [document element](https://dom.spec.whatwg.org/#document-element).

As a simple example, we write `html::view-transition-group(foo)` where the actual parent relationship is `html::view-transition::view-transition-group(foo)`

So it almost sounds like the thing that should work is
`html:has(::view-transition-new(foo):only-child)::view-transition-group(foo)`

which is kind of confusing.

To support `html::view-transition-group(foo):has(::view-transition-new(foo):only-child)`, we might have to change the VT spec to be able to support arbitrary descendent skipping behavior. In other words, even with this example, `::view-transition-new(foo)` is not directly attached to `::view-transition-group(foo)` (it's on the `::view-transition-image-pair(foo)`), so for it to work we have to search "somewhere under this pseudo" there is another pseudo called this. This is, FWIW,  is what I think would happen in a non-pseudo tree cases.


-- 
GitHub Notification of comment by vmpstr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12630#issuecomment-3818798551 using your GitHub account


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

Received on Thursday, 29 January 2026 16:29:00 UTC