| ▲ | yurishimo 17 hours ago | |
Just a heads up but datalist is not really a great solution if you need a strong contract. The user can still type whatever they want into the field and there is no fuzzy filtering or typo mitigation. Once you add those requirements, a library that gives you a more fully featured combobox is likely going to make a lot of sense in your project. | ||
| ▲ | vlucas an hour ago | parent | next [-] | |
Very true, and ran into this one specifically myself when going down the "HTML can do this!" road. HTML can NOT, in fact, replace a good combobox with search input. Datalist has significant shortcomings. I wound up using a React island for this single input inside otherwise normal HTML, despite my own objections, because it really it just that much better than the native options. | ||
| ▲ | sarchertech an hour ago | parent | prev | next [-] | |
There’s still browser/OS typo mitigation. | ||
| ▲ | reaperducer an hour ago | parent | prev [-] | |
That's the whole sanitize vs. validate argument debate that keeps coming up. How you handle it is project-dependent. But if you're doing a real web site, not an SPA, you can show an error/help page, or re-load the current page with the error/help message. | ||