←back to thread

367 points lemonberry | 2 comments | | HN request time: 0.648s | source
Show context
macawfish ◴[] No.24641169[source]
I recently stumbled across "shoelace", which at a glance seems like an example of what the article is hoping for. It's a thoughtfully designed library of UI web components.

https://shoelace.style/

replies(3): >>24641310 #>>24641427 #>>24642064 #
ssorallen ◴[] No.24641427[source]
Thanks for the link. This library unfortunately highlights further challenges with Web Components like mixing custom WCs with native form elements. To use Shoelace form elements at all, you'll end up writing a bunch of JavaScript.

> Shoelace forms don't make use of action and method attributes and they don't submit the same was as native forms. To handle submission, you need to listen for the slSubmit event as shown in the example below and make an XHR request with the resulting form data.

> https://shoelace.style/components/form

replies(2): >>24642088 #>>24646202 #
1. claviska ◴[] No.24646202[source]
> To use Shoelace form elements at all, you'll end up writing a bunch of JavaScript.

Shoelace author here. This is somewhat true (I wouldn’t call it “a bunch” though), and it will be until form-associated custom elements are standard. However, I’d argue that most form validation and submission is done with JavaScript these days. I can’t think of the last time I saw a post request submitted from a form in the wild. (Not that it doesn’t happen, but it seems to be quite rare now.)

replies(1): >>24663581 #
2. ssorallen ◴[] No.24663581[source]
Thanks for the reply! Shoelace does look great, and I recognize doing the form submission this way is a requirement currently. Hopefully the links above about allowing custom WebComponents to act as native form elements will further enable Shoelace.