Re: [csswg-drafts] [css-contain] Container queries within display:none are difficult to implement (#8197)

The CSS Working Group just discussed `[css-contain] Container queries within display:none are difficult to implement`, and agreed to the following:

* `RESOLVED: elements within a display:none subtree have no parents that container queries can access`

<details><summary>The full IRC log of that discussion</summary>
&lt;emeyer> oriol: Problem is that browsers tend to avoid computing style of elements inside a display: none subtree<br>
&lt;emeyer> …You can still force the computation with JS<br>
&lt;emeyer> …What should happen if one of these elements may have a container which is applying some rules conditionally, which may affect the comptued style you get?<br>
&lt;emeyer> …Gets more complicated if ancestor is a container or not<br>
&lt;emeyer> …In Blink, I think this was easier to implement per spec since it has some caching and first computation is cached<br>
&lt;emeyer> …That way we know if ancestors are containers or not<br>
&lt;emeyer> …Firefox doesn’t have this caching, so when it computes, the information isn’t stored in the element<br>
&lt;emeyer> …emilio didn’t think my patch to pass information around was the best<br>
&lt;emeyer> …Discussion agreed it was reasonable that an element in a display: none subtree should be treated as having no container<br>
&lt;emeyer> …This might not be good for style queries<br>
&lt;emeyer> emilio: Some of this is complexity specific to Firefox, but in general, some of this is very messy and not very interoperable<br>
&lt;emeyer> …I’m not a fan of adding complexity here<br>
&lt;emeyer> …We do something similar where older browsers do transforms on display: none elements as none<br>
&lt;emeyer> …I’d rather do the easy-to-implement thing instead of having extra complexity<br>
&lt;emeyer> …I don’t think it’s particularly useful to check elements based on container queries when the container isn’t there<br>
&lt;emeyer> …Any answer will be weird<br>
&lt;emeyer> astearns: Is there a way of having elements escape a display: none ancestor using CSS?<br>
&lt;emeyer> emilio: No, which is why browsers optimize them away<br>
&lt;emeyer> astearns: Then I have no concerns<br>
&lt;emeyer> …Proposed resolution: elements within a display:none subtree have no parents that container queries can access<br>
&lt;emeyer> emilio: The wording could be they have no query containers, though I’d like room to confirm this is fine<br>
&lt;emeyer> …We can resolve and seek comment after<br>
&lt;emilio> s/room/Rune<br>
&lt;emeyer> astearns: Anyone on the call want to wait for Rune’s response?<br>
&lt;emeyer> (silence)<br>
&lt;emeyer> RESOLVED: elements within a display:none subtree have no parents that container queries can access<br>
</details>


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


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

Received on Wednesday, 22 March 2023 15:55:03 UTC