Re: [csswg-drafts] [css-shared-element-transitions-1] Pseudo-element selectors for shared element transitions (#7743)

> Without this, we'll still have to go down the path of creating pseudo-element references, and it's not even clear if that should work for ::part

Did you mean references for script? The CSS API can be the same in both approaches with the use of ::part.

For script access, we don't want to allow script to do everything that the Element API allows (like reparenting the element out of the shadow DOM). So the choices for adding that later would be:

- CSSPseudoElement IDL, if we go with pseudo-elements.
- Give an element reference but fail on API calls which shouldn't be allowed if we go with shadow DOM.
- A new SET specific IDL which exposes the limited APIs which make sense. This can be the approach with either shadow DOM or pseudo-elements. But I think it won't be needed if we go with pseudo-elements since the CSSPseudoElement IDL will line up closely with what makes sense to expose.

I did want WA-API to be available to script in the initial version of this feature. And it looks like you can't target an element in a shadow DOM using the ::part selector with pseudoElement option, as opposed to selectors which target pseudo-elements. This [example](https://jsbin.com/jinakoyewo/edit?html,output) doesn't work in Chrome/Firefox/Safari. 

The Scoped transitions aspect is what makes shadow DOM dealbreaker for me. The fact that developers lose the ability to use an element, which is a shadow host, as the root for a scoped transition. We'd be forcing developers to add nodes just so the browser has an element to attach the transition's shadow DOM to.

Pseudo-elements and shadow DOM could be made equivalent in functionality given that both can be targeted in CSS the same way. But the desire for exploring shadow DOM (from the discussion [here](https://github.com/WICG/shared-element-transitions/issues/190)) is to have a potentially simpler implementation. Shadow DOM seems to push complexity from the implementor to developer.

> do we just get to own that space since we arrived first?
You don't miss what you didn't have? ^_^

>  I suggested that the shadow root be attached to a pseudo-element
This is a road I don't want to go down. It gets really weird if a pseudo-element becomes an ancestor for real elements.

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


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

Received on Thursday, 15 September 2022 18:29:56 UTC