[csswg-drafts] [css-cascade-6] Do we need 'sibling' scopes in @scope? (#8299)

mirisuzanne has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-cascade-6] Do we need 'sibling' scopes in @scope? ==
The `@scope` rule defines a scope root selector, and lower boundary selectors - which define a 'scope' as a tree fragment of any matched 'root' and all the descendants up to (and not including) boundary elements or descendants of those boundary elements. In that definition, scopes are always defined by ancestor/descendant relationships.

A few people (including @tabatkins) have suggested that we also need 'sibling' scopes. They would similarly start with a root selector, and allow 'boundary' elements, but the scope would be horizontal rather than vertical: including a root and all subsequent siblings, up to (and not including) and boundary siblings. Boundary siblings, and further siblings after the boundary would be out of scope.

We did resolve at TPAC to add a [proximity-aware sibling combinator](https://github.com/w3c/csswg-drafts/issues/7233) `~~` to parallel the proximity-aware descendant combinator `>>` - so that suggests we might want the same option for scoping itself.

I think there are clear author use-cases here, though I haven't done extensive work collecting those examples. I don't think authors have historically thought of these as 'scope' issues, but it does make sense to me that they require the same functionality turned horizontal. I'm in favor of this, but don't have clever ideas for syntax - maybe a keyword in the `@scope` preamble?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8299 using your GitHub account


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

Received on Tuesday, 10 January 2023 21:06:32 UTC