←back to thread

277 points merqurio | 1 comments | | HN request time: 0s | source
Show context
kubb ◴[] No.45113384[source]
For the frontend work that I did, Lit was a godsend. It really helps you build components and apps without getting in the way.

In comparison, Angular is a monster, and React is designed for the old browser capabilities, and is now staying around by inertia, not by inherent quality.

replies(3): >>45113627 #>>45113773 #>>45114105 #
pmg101 ◴[] No.45113627[source]
Which old browser capabilities are you referring to? Could you say more, or link to more details?
replies(1): >>45113746 #
kubb ◴[] No.45113746[source]
No shadow DOM, no web components, no template strings, etc.
replies(1): >>45114479 #
troupo ◴[] No.45114479[source]
> No shadow DOM

Funny you should say that when the current advise for web components is to avoid Shadow DOM (almost like the plague)

> no web components

As in?

> no template strings

Why would React need template strings? React is not the only framework that doesn't use template strings for anything (Vue, Solid, Svelte come immediately to mind). And it's hard to accuse those of being behind the times when Solid is literally the reason for the upcoming native signals proposal

replies(1): >>45116314 #
azangru ◴[] No.45116314[source]
> the current advise for web components is to avoid Shadow DOM (almost like the plague)

Could you provide the source for this advice?

replies(2): >>45117066 #>>45120262 #
jfagnani ◴[] No.45117066[source]
It's wrong - both that it's general "current advice", and the advice itself when it does pop up.

Yes, there are some people who say to build web components without shadow DOM, but I'm convinced they're only building leaf nodes so they don't need composition with slots. As soon as they try to build any kind of container element they hit big problems.

replies(3): >>45120776 #>>45125423 #>>45126582 #
troupo ◴[] No.45125423[source]
> It's wrong - both that it's general "current advice", and the advice itself when it does pop up.

Unless you actually care about the web and its users. Then it turns out it's a very wise advice.

https://w3c.github.io/webcomponents-cg/2022.html

Web Components Community Group: 2022. You are one of the authors:

--- start quote ---

It's worth noting that many of these pain points are directly related to Shadow DOM's encapsulation. While there are many benefits to some types of widely shared components to strong encapsulation, the friction of strong encapsulation has prevented most developers from adopting Shadow DOM, to the point of there being alternate proposals for style scoping that don't use Shadow DOM.

...

Selection does not work across or within shadow roots. This makes fully-featured rich-text editors impossible to implement with web components. Some of the web's most popular editors have issues that are blocked on this functionality

...

Shadow boundaries prevent content on either side of the boundary from referencing each other via ID references. ID references being the basis of the majority of the accessibility patters outlines by aria attributes, this causes a major issue in developing accessible content with shadow DOM.

--- end quote ---

Those are just the tip of the iceberg as these are very explicitly stated in the doc.

Then there's the issues of shifting the responsibility to both developers and consumers to handle Shadow DOM correctly.

Styling/themeing is still pain despite several different specs like shadow parts.

Don't use styles in your components too much, use Javascript to inject CSS into document and shadow trees or else there will be performance impact https://w3c.github.io/webcomponents-cg/2022.html#constructab...

Don't use too many shadow roots or there will be performance impact https://front-end.social/@5t3ph/115135994774490769 (linked in the sibling comment by @azangru)

You can't participate in forms until you write more JS for it, and still your submit buttons will be broken with no solution in sight.

etc. etc.

You don't have to take my word for it. Here's Nolan Lawson, emphasis mine:

--- start quote ---

https://nolanlawson.com/2022/11/28/shadow-dom-and-accessibil...

Shadow DOM is a kind of retcon for the web. As I’ve written in the past, shadow DOM upends a lot of developer expectations and invalidates many tried-and-true techniques that worked fine in the pre-shadow DOM world.

--- end quote ---

replies(1): >>45125774 #
mdhb ◴[] No.45125774{3}[source]
Did web components kill your dog or something? You have this truly bizarre fixation on the topic for multiple years now.
replies(1): >>45126298 #
troupo ◴[] No.45126298{4}[source]
Perhaps I care about the direction in which the web is pushed by a very small number of people incapable of seeing beyond their solutions and incapable of admitting their own mistakes.
replies(2): >>45126553 #>>45127070 #
1. brazukadev ◴[] No.45126553{5}[source]
I'm 100% with you on that.