Re:If Web Components are so great, why am I not using them?
by verisimilidude on Wednesday August 02, 2023 @06:27PM
(#36978619)
When you see this, it’s a sign that someone built their web components with React/Angular/Vue on the brain.
The tech is fine. You can achieve amazing progressive enhancement with web components by understanding and effectively using <template> and <slot>. However, many web component developers never learn this.
The problem you’re describing is a training/marketing issue, as discussed in the post.
Re:If Web Components are so great, why am I not using them?
by arcbyte on Wednesday August 02, 2023 @06:40PM
(#36978809)
The browsers really need to make it possible to use templates and slots without javascript at all. There's no reason I shouldn't be able to define and use a custom element using HTML alone.
Until then I don't know if template and slot will take off.
Re:If Web Components are so great, why am I not using them?
by no_wizard on Wednesday August 02, 2023 @08:34PM
(#36979815)
This is what everyone in userland clamors for as a baseline. Decade plus old arguments about this.
I have little hope this will happen
Re:If Web Components are so great, why am I not using them?
by verisimilidude on Wednesday August 02, 2023 @09:02PM
(#36980015)
Fully agreed.
Re:If Web Components are so great, why am I not using them?
by lenkite on Wednesday August 02, 2023 @09:12PM
(#36980098)
We had HTML imports and they got rid of it. No JS means No Ads.
Re:If Web Components are so great, why am I not using them?
by no_wizard on Wednesday August 02, 2023 @09:30PM
(#36980236)
It means less invasive tracking really, not no ads.
Ironically it was Firefox that killed it, not Google. Google was all in on HTML imports. It would have also given a non JS way to dynamically load HTML. Streaming would have been great with this.
Re:If Web Components are so great, why am I not using them?
by adjav on Wednesday August 02, 2023 @10:50PM
(#36980802)
HTML imports required JS to be used - otherwise all you had was a `link`ed DOM tree that you couldn't access. No one has really proposed a way to dynamically load anything without JS AFAIK.
Re:If Web Components are so great, why am I not using them?
by dmazzoni on Thursday August 03, 2023 @01:30AM
(#36981773)
FWIW, all the major screen readers fully support JavaScript. There's nothing inherently inaccessible about a website that uses JavaScript. In fact, the screen readers don't actually interpret the JavaScript at all - they just react to the page dynamically changing, it doesn't matter how it's accomplished.
Re:If Web Components are so great, why am I not using them?
by superkuh on Thursday August 03, 2023 @10:23AM
(#36986368)
There's nothing inherent no, just that javascript webpages, if some CDN doesn't load fast enough, or the dev uses some bleeding edge function not in all browsers, etc, will not end up having the text in the page. Whereas actually having the text in the page always has the text in the page.
JS sites almost always fail very badly when it fails (a relatively common event). Text sites cannot fail even when they fail.
When I go to a website and all I see if a bunch of blank gray boxes that means they're using web components. It encourages developers to not put the text or images in the HTML and instead to load them externally after the page is loaded with javascript. That's slow, brittle, and stupid for most web documents. It's the opposite of progressive enhancement that fails gracefully. Web components just leave blank nothing that ruins accessibility for screen readers.