Hacker News new | ask | show | jobs
by nine_k 895 days ago
But how about Web Components? Finally, it seems, there's something reusable, and something reasonably framework-neutral.
3 comments

You will need to wait another 10-15 years before they overcome the issues that they caused for themselves (while twisting and contorting the platform in unpredictable ways): https://threadreaderapp.com/thread/1717580502280867847
is it that nice?

the beauty of HTML markup is that it's declarative. at least from the tutorials I've seen, WebComponents drag you firmly back into imperative land with document.addChild everywhere.

The imperative part is required to build a Web Component.

When you merely import it. you can use it as declaratively as any other HTML tag. Basically Web COmponents allow you to add your own tags that are rendered as components, and freely mix "built-in" and "custom" DOM nodes in your document.

I'm pretty sure a declarative shadow Dom is currently in the works.
Web Components are how you can create user-land HTML elements.

But there is a widespread desire for better native HTML elements.

E.g., a date range input.

I'd say that it's the other way around, and native elements that are not system-dependent (say, a video player) should lose prominence. There's no reason to have a "native-looking" button on a web page, which otherwise cannot (and should not) be made native-looking.

Instead I expect the industry to stabilize around a few widespread sets of web components, much like a lot of CSS for controls stabilized around Bootstrap's styles.

Which controls stabilized around Bootstrap styles (now there's a a name I haven't heard in a long time)?

No, industry should not and will not stabilize around "few widespread sets". For the simple reason: it's extremely difficult to create a proper userland UI control in the browser. How many custom drop downs fail even the most basic keyboard behaviours? How many custom UI elements fail even the most basic screenreader interactions? etc. etc.

What you really truly need is a rich browser-native set if controls, and https://open-ui.org/ is slowly working towards that.

Related: You can't capture the nuance of my form fields https://web.archive.org/web/20230208235009/https://drewdevau...