Re: [csswg-drafts] [css-contain] Is there a use-case for querying explicit container selectors? (#6176)

> 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?

I can't remember the _exact_ use-cases for this, but given there were tons of these in my practice for skipping the stacking context etc, I'm pretty certain there would be use-cases for this (I'll try to remember/come up with such` use-cases if I'll have time).

As a quick idea — I imagine most of such use-cases could be whenever we have something that escapes its own scope, but need to also need the grandparent's scope as well. Think of a content column, where something wants to escape the content grid and stretch among the whole width of the page — it would make sense to make the content column a container, so everything inside would scale properly, but then we wouldn't be able to make a child wider than that container, and at the same time to know the upper boundaries. (I can illustrate this example if I couldn't describe it properly, let me know!)

Said that, the universal “nearest” container is a really nice default, as in most cases we'd want for our components to just work and adjust to the nearest container. However, for more complex scenarios we would want to skip some levels of containment when we know the selector of the thing we want to rely on.

Another possible case: https://github.com/w3c/csswg-drafts/issues/6177 — it could benefit from the targeted containment (I'll try to describe how in that PR).

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


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

Received on Saturday, 3 April 2021 12:13:32 UTC