- From: Romain Menke via GitHub <noreply@w3.org>
- Date: Sun, 25 Jan 2026 17:08:39 +0000
- To: public-css-archive@w3.org
> This scoping root would still have the implicit behavior of relative selectors:
> ```css
>@scope including (.my-design-system) {
> :special-scoping-root .bg-primary {}
>}
>```
>This wouldn't be different from:
>```css
>@scope (:has(> .my-design-system)) {
> .bg-primary {}
>}
Thinking about this more, the definition of the `@scope` root maybe doesn't need to align with the scoping root for the relative selectors itself?
So `@scope including (.my-design-system)` could create a scope that is exactly the same as `@scope (.my-design-system)` but the scoping root would be `:has(> :scope)`.
The scope would still prevent elements from outside the scope from being matched.
Still weird that the scope root for `@scope` isn't the same as the scoping root for the relative selectors 🤷
----
I do think the use case is valid.
Not only for utility classes by anywhere you want to scope an entire stylesheet to a sub section of the element tree.
The only way to do that now is to add wrapper elements around each section, as you said.
But that assumes control over the html.
Maybe there are 3rd party elements with slots for even more 3rd party elements.
Unsure how this is best solved.
--
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13391#issuecomment-3796966614 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 25 January 2026 17:08:40 UTC