Re: [csswg-drafts] [selectors] Pseudo-class to indicate when a slot has content (#6867)

The CSS Working Group just discussed `[selectors] Pseudo-class to indicate when a slot has content`, and agreed to the following:

* ``RESOLVED: `:has-slotted` should match when the fallback content is not being displayed``

<details><summary>The full IRC log of that discussion</summary>
&lt;kbabbitt> keithamus0: tldr from thread is chrome has :slotted, it can match on a few different things<br>
&lt;kbabbitt> keithamus0: concept of flattened vs non-flattened tree<br>
&lt;kbabbitt> ... flagged in firefox and chrome as non-flattened tree<br>
&lt;kbabbitt> ... so it can match direct descendant of a slot<br>
&lt;kbabbitt> ... some contention around this<br>
&lt;kbabbitt> ... setting flattened to true would mean it would make child slots transparent effectively<br>
&lt;kbabbitt> ... so if you have a slot slotted by another slot then that slot [missed]<br>
&lt;kbabbitt> ... my opinion is we should keep behavior as-is<br>
&lt;kbabbitt> ... that's the only way you can match slotted content<br>
&lt;kbabbitt> ... even if it's just a text node as a descendant of a slot element<br>
&lt;kbabbitt> ... web components cg is asking for commitment that this is acceptable<br>
&lt;emilio> q+<br>
&lt;kbabbitt> ... as long as we define the alternatives to that<br>
&lt;astearns> ack rachelandrew<br>
&lt;kbabbitt> ... chief use cases are: has my slot been populated? what has it been populated with?<br>
&lt;astearns> ack emilio<br>
&lt;kbabbitt> emilio: flattened true and flattened false - only effective difference is nested slots right?<br>
&lt;kbabbitt> keithamus0: that's true, has-slotted will always match populated text nodes<br>
&lt;kbabbitt> ... nested slots become transparent<br>
&lt;kbabbitt> [missed some context]<br>
&lt;kbabbitt> keithamus0: how do you determine nested slots is the short summary<br>
&lt;kbabbitt> emilio: to me, flattened tree behavior is what I'd expect as an author<br>
&lt;kbabbitt> ... components that use nested slots... that becomes useless<br>
&lt;kbabbitt> ... a bit confused about when you'd want to differentiate between useful slotted content and empty slot<br>
&lt;kbabbitt> ... why would you want flattened behavior?<br>
&lt;kbabbitt> keithamus0: other way around makes more sense for that use case, am I displaying default slotted content<br>
&lt;kbabbitt> emilio: right but if you have an empty slot you could do that?<br>
&lt;kbabbitt> keithamus0: I don't think so?<br>
&lt;kbabbitt> ... will have to test<br>
&lt;kbabbitt> emilio: my understanding is that you'd display default content of nested slot<br>
&lt;dbaron> (that would be my assumption ^)<br>
&lt;kbabbitt> ... flattened behavior is easier but I'm surprised that's most useful<br>
&lt;kbabbitt> ... would not object but might be worth checking<br>
&lt;kbabbitt> ...ideally has-slotted should reflect fallback content<br>
&lt;kbabbitt> keithamus0: agree, that's my understanding of what flattened false would do<br>
&lt;kbabbitt> emilio: assuming that's the case flattened false seems reasonable<br>
&lt;kbabbitt> ... if you want we can resolve that we make has-slotted match fallback content<br>
&lt;keithamus0> PROPOSED RESOLUTION: `:has-slotted` should match when the fallback content is not being displayed<br>
&lt;kbabbitt> astearns: doesn't mention flat tree deliberately<br>
&lt;kbabbitt> ... but if it turns out flat tree is desired behavior, [?]<br>
&lt;kbabbitt> keithamus0: need to confirm<br>
&lt;kbabbitt> ... whether a slot would display fallback content<br>
&lt;kbabbitt> ... but if that's the case it shouldn't use the flat tree, but if it isn't then it should<br>
&lt;kbabbitt> RESOLVED: `:has-slotted` should match when the fallback content is not being displayed<br>
</details>


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


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

Received on Wednesday, 8 January 2025 17:56:08 UTC