logoalt Hacker News

spankaleeyesterday at 7:01 PM2 repliesview on HN

That's styling itself sure, but it's not self-evidently self-contained. Does every component emit those styles? Are they in the page stylesheet? How do they get loaded?

Counterpoint: Shadow DOM is great. People should be using it more. It's the only DOM primitive that allows for interoperable composition. Without it you're at the mercy of frameworks for being able to compose container components out of internal structure and external children.


Replies

dfabulichyesterday at 8:13 PM

https://2025.stateofhtml.com/en-US/features/web_components/

Sort by negative sentiment; Shadow DOM is at the top of the list, the most hated feature in Web Components. You can read the comments, too, and they're almost all negative, and 100% correct.

"Accessibility nightmare"

"always hard to comprehend, and it doesn't get easier with time"

"most components don't need it"

"The big issue is you need some better way to some better way to incorporate styling from outside the shadow dom"

> It's the only DOM primitive that allows for interoperable composition.

There is no DOM primitive that allows for interoperable composition with fine-grained reactivity. Your framework offers fine-grained reactivity (Virtual DOM for React/Preact, signals for Angular, runes for Svelte, etc.) and any component that contains another component has to coordinate with it.

As a result, you can only mix-and-match container components between frameworks with different reactivity workflows by giving up on fine-grained reactivity, blowing away the internals when you cross boundaries between frameworks. (And Shadow DOM makes it harder, not easier, to coordinate workflows between frameworks.)

Shadow DOM sucks at the only thing it's supposed to be for. Please, listen to the wisdom of the crowd here.

show 2 replies
yawaraminyesterday at 8:13 PM

Yeah but most people don't need or want 'interoperable composition', they want sites with a consistent look-and-feel. Shadow DOM makes this much more difficult.