Re: [WICG/webcomponents] "open-stylable" Shadow Roots (#909)

> To me, the key open question that needs to be answered is whether selective adoption of document-level stylesheets is necessary or not. That is, should a component or users of the component need to be able to filter (i.e. selectively apply) which stylesheet or style rules apply to its shadow tree.

I think filtering is needed.  

There are numerous use cases and comments in this and the preceding [related issue](https://github.com/WICG/webcomponents/issues/864) saying or assuming as much.

More fundamentally:

**Use cases are intertwined.** 

Whether simple (I just want my page resets to work in my shadow tree) or most painful (component and context are controlled by different entities) or in between, use cases trace to the same shadow encapsulation, and loosening encapsulation will likely impact many if not all in some way.

**Declarative shadow DOM is required.**  

To me, declarative shadow DOM is required from the onset not just because it is a new thing so logically it must be supported too, but because shadow trees are just HTML and they are what are doing the encapsulating to loosen. And they are a part of the solution.

So Javascript-only solutions are basically out.  And polyfillability though not a strict requirement is in this case something of an acid test for completeness.

But also declarative shadow trees already by design address opt-in for imperatively-created web components.

**Context-aware opt-in protection is needed.**

I don't think an opt-in flag or mode that just brings in all page styles would work as expected in all cases. Some shadow styles could unexpectedly lose. Or get pulled back into a specificity race that could feel like shadow trees just gave up.

**Prioritization is required.**

Or maybe just unavoidable, since unlayered styles are of necessity assigned a layer priority. And a limited form of priority for shadow trees already exists in the context step, so any brought-in styles would pass through that step too.

The [shadow layers proposal](https://github.com/WICG/webcomponents/issues/909#issuecomment-1993388146) addresses these requirements, and other proposals and syntaxes certainly could too.

I hope decisions like filtering-yes-or-no will help move this issue forward to actionable proposals and resolution.  We have new tools to do that.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/909#issuecomment-2000272076
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/909/2000272076@github.com>

Received on Friday, 15 March 2024 18:58:25 UTC