- From: Miriam Suzanne via GitHub <sysbot+gh@w3.org>
- Date: Fri, 02 Apr 2021 19:14:58 +0000
- To: public-css-archive@w3.org
mirisuzanne has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-contain] Is there a use-case for querying explicit container selectors? == @dbaron's [original proposal](https://github.com/dbaron/container-queries-implementability#proposal) included an explicit selector for the container to be queried: ```css @container <selector> (<container-media-query>)? { // ... rules ... } ``` In part, that's explained as a way to implement scope as part of containment. But I'm not sure those two features always make sense together, and all the CQ use-cases I've encountered so far rely on: - Querying the _most immediate available space_ - Being able to _move components between containers_ Requiring an explicit selector would make those use-cases more difficult, since it makes the query less modular, and potentially less relevant to immediate context. That said, if the selector is useful in some cases, we could consider allowing it as an optional syntax: ```css @container (<selector>)? (<container-media-query>)? { // ... rules ... } ``` Aside: - I imagine it only works when the selectors inside the query are descendants of the container selector. - What if a selector is provided without any other query conditions? Is that allowed? It starts to look a lot like scopeā¦ I can imagine some hypothetical use-cases, though most would be solved by using descendant selectors (or `@scope`) along with container queries. In those cases it might be syntax sugar, but doesn't provide much. More important would be any use-cases where an author wants to "skip over" the most immediate container context, and query a container farther up in the DOM tree. Do those use-cases exist? Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6176 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 2 April 2021 19:15:00 UTC