Re: [csswg-drafts] [css-scoping] Allow elements to expose a subset of their shadow tree, which can then be styled with regular CSS (#10939)

I really like the direction this is going. At TPAC, I suggested that we want the old deep/shadow combinators (similar to `>>>` here) restricted to the virtual part tree, conceptually similar to the export tree proposed here. A few initial thoughts in case it sparks any other ideas:

1. A number of CSS features seem to be swirling around a general concept I've been thinking of as a _CSS policy_. This is the idea that there are often multiple sources of truth for how something can and should be styled (or not) and the page needs a way to rationalize what styling actually applies. Features which are either directly or indirectly related to this include: the cascade in general, Shadow DOM style encapsulation, `@scope`, `@layer`, css custom properties, appearance, and probably others. I wonder if there is some grand unified theory here, and yeah, that is intended to make it sound hard.
2. With the previous point in mind, it would be really valuable if this ability to create an explicit styling structure was not coupled with Shadow DOM and could apply to other arbitrary areas of the document. This would allow templating that wants control over styling not to require using Shadow DOM. The `@scope` rule introduced a type of more limited scoping very different from Shadow DOM but often serving _some_ of the same needs. Perhaps this could be integrated with it.
3. While there is clarifying value in explicitly annotating the DOM for this, could we envision a way to do this purely in CSS? Really roughly (inspired by `@scope`): `@isolate (.foo) to (.bar) { @export .zot; } }`

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


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

Received on Thursday, 26 September 2024 15:22:12 UTC