Re: [csswg-drafts] [css-shadow-parts][css-scoping] Is ::slotted() allowed after ::part()? (#10807)

The CSS Working Group just discussed `[css-shadow-parts][css-scoping] Is ::slotted() allowed after ::part()?`, and agreed to the following:

* `RESOLVED: don't allow ::slotted after ::part`

<details><summary>The full IRC log of that discussion</summary>
&lt;dholbert> dbaron: this is the last one of these<br>
&lt;dholbert> dbaron: is ::slotted allowed after ::part?<br>
&lt;dholbert> dbaron: this only makes sense if a shadow DOM exposes a slot as a part<br>
&lt;dholbert> lea: I've done that<br>
&lt;dholbert> dbaron: ok. So it sounds like this is maybe a useful thing to do sometimes<br>
&lt;emilio> q+<br>
&lt;dholbert> lea: that's useful when you want to expose a part but you don't want to pay a separate container for it. It can become a box. why not expose it<br>
&lt;dholbert> dbaron: So, the current state of allowing ::slotted after ::part is that Chromium and Gecko do not allow it<br>
&lt;dholbert> dbaron: WebKit allows it at parse time but it doesn't match the things I thought it should match<br>
&lt;dholbert> dbaron: there are 2 points here.<br>
&lt;dholbert> dbaron: (1) it's not clear to me if there's much of a use-case for ::slotted after ::part<br>
&lt;dholbert> dbaron: (2) it's pretty complex to implement<br>
&lt;lea> q+<br>
&lt;dholbert> dbaron: it's combining things that jump in/out of shadow trees in ways that are extra fun and raise questions about how to cascade rules from different sources<br>
&lt;dholbert> dbaron: general rules suggest that this should be allowed, but it's a good bit of work to do correctly, and it's not clear to me if there are actually good use-cases for it<br>
&lt;dholbert> dbaron: and if it would require rewriting a bunch of scary code in the middle of cascade impl to do something obscure that nobody needs<br>
&lt;Rossen6> ack emilio<br>
&lt;dholbert> emilio: I was going to say what dbaron just said<br>
&lt;dholbert> emilio: I'm pretty sure the reason this doesn't work  in webkit is:<br>
&lt;dholbert> emilio: when youre styling a slotted node, you look at the trees from the shadow-trees where you're slotted (?)<br>
&lt;dholbert> emilio: the slotted combination makes it go out of the trees you would usually look at, which is why it doesn't work<br>
&lt;dholbert> emilio: this doesn't seem useful. I'd rather not allow it, &amp; agree with dbaron<br>
&lt;RRSAgent> ok, fantasai; I will not start a new log at midnight<br>
&lt;dholbert> lea: the use-case for me was for a wrapper that's there whether you have the fallback content display or not<br>
&lt;dholbert> lea: doing that with a nested element... you have to wrap the slot with a separate element... I suppose that'd work<br>
&lt;dholbert> lea: there was a reason, but I need to remember it<br>
&lt;keithamus>  q+<br>
&lt;dholbert> dbaron: it's not just about why did you want to expose a slot as a part, but: if you did that, would you want to use ::part::slotted _from outside_<br>
&lt;Rossen6> ack lea<br>
&lt;dholbert> emilio: there are use cases for exposing slots as parts, thats's what the details element ended up doing<br>
&lt;dholbert> emilio: but the question is why would you do details::slotted::div (?) instead of details>div<br>
&lt;Rossen6> ack keithamus<br>
&lt;emilio> s/details::slotted::div/details::details-content::slotted(div)/<br>
&lt;dholbert> keithamus: for something to be slotted, you can query for it... the only thing you  gain from ::slotted on the outside is to know that it's a descendant of a named ::part. but I can't see why that would matter in practice<br>
&lt;dholbert> keithamus: it kind of exposes an impl detail of the shadow dom that might be undesirable<br>
&lt;emilio> q+<br>
&lt;dholbert> keithamus: would you have to make it unmatchable in a closed shadow root?<br>
&lt;Rossen6> ack emilio<br>
&lt;dholbert> emilio: we resolved to add :has(:slotted) , so that detail would already be exposed via that pseudo-class<br>
&lt;dholbert> keithamus: good point, maybe we should ???<br>
&lt;lea> s/:has(:slotted)/:has-slotted/<br>
&lt;emilio> s/:has(:slotted)/:has-slotted/<br>
&lt;dholbert> dbaron: even though it's a closed shadow-root, it's exposed as a part. there's supposed to be something exposed there<br>
&lt;lea> q+ to say, it's definitely not high priority. Q: if we decide to not allow it now, is that something we can revisit later or will we run into web compat?<br>
&lt;dholbert> emilio: in general we haven't gone very far on trying to prevent exposing pseudo-classes/elements that are dependent on what element the part is<br>
&lt;dholbert> emilio: some are useful. you can do ::part ::placeholder to style a placeholder - that's an actual thing that was requested<br>
&lt;dholbert> emilio: I'm not sure we should go to great lengths to avoid matching ::has(::slotted)<br>
&lt;dholbert> er :has-slotted<br>
&lt;emilio> s/::has(::slotted)/:has-slotted after ::part()<br>
&lt;dholbert> lea: if we decide not to do it, can we revisit this in the future?<br>
&lt;dholbert> lea: or will we be hit by webcompat in that scenario?<br>
&lt;emilio> +1 to dbaron<br>
&lt;dholbert> dbaron: always some risk of webcompat problems. Maybe there already are webcompat problems. But I think this is in the category of low-risk, and we could allow it in the future even if we don't do it now. But not a thing we can promise<br>
&lt;fantasai> +1 to dbaron<br>
&lt;dholbert> dbaron: and I can't even really promise that we can do it now<br>
&lt;dholbert> Proposed resolution: don't allow ::slotted after ::part<br>
&lt;dholbert> RESOLVED: don't allow ::slotted after ::part<br>
&lt;lea> When do we reconvene?<br>
&lt;astearns> lea: 7 minutes ago officially, but I am guessing 5-10 minutes from now<br>
&lt;keithamus> We are reconvening<br>
&lt;emilio> scribe+<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10807#issuecomment-2380290387 using your GitHub account


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

Received on Friday, 27 September 2024 23:44:35 UTC