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

From dealing with lots of web component developers for many years, and trying to suss out what they want out of these requests, I really believe that the separate DOM tree is absolutely necessary and that composition is the irreducible feature.

> maybe such a separation of concerns is not needed in most use cases where a single party tends to have control over everything?

I think the idea of "single party" is of limited use here, because there are very often closely related parties who have some level of trust, but where they still need to make some contracts between them. Design system teams serving several application teams is a very common example among web component authors right now.

And when there is a true single party they seem mostly ok with the features available now because they can write stylesheets specially for shadow DOM, and share styles via constructible stylesheets.

For those multi-party but with some trust systems, we see components used in different frameworks and imperative scenarios, and it's critical that setting innerHTML or a framework rendering child nodes work without destroying the component's internal DOM.

```tsx
return <my-element>{children}<my-element>
```
^ this React code will completely clear a component's own DOM if the component's not using shadow DOM. And this is what developers come to us complaining about when they disable shadow DOM in order to allow their customers to use existing legacy stylesheets.

I don't see how a CSS-based composition system could fix this because the important part is that the user of the component can't accidentally overwrite component's DOM. If the both the component and user are trying to write to the component's child list, that's the problem.

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

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

Received on Tuesday, 16 January 2024 02:55:58 UTC