HTML can do that. yes. but adoption? welp, I don't really care nor will I use it unless I have to. I will use whatever was available in practice and continue to use them.
HTML Can Do That
71–80 of 249 posts
Re: HTML Can Do That
#72Just 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.
Hard pass, that's essentially unusable.
Re: HTML Can Do That
#73This comment by yurishimo should not be [dead], imo >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. It is true! HTML can…
I mildly disagree. You still have to validate what the browser gives you. The user could have edited the "strong contract" using browser dev tools. So, let the user type, then validate in javascript if you want instant feedback (by changing colors, say, to red / orange), but ideally don't fully block it from being seen by the server. And do the real validation on the server side. This is what I found to be fairly rob…
I’m not advocating for willy-nilly package inclusion, just highlighting a current shortcoming of datalist that is often not mentioned in these sorts of articles.
Re: HTML Can Do That
#74Related to this, I’d love that HTML natively support sortable tables. This is a common need but every single time I have to reimplement it.
You want client side table sorting? It's really easy to do this with server rendered HTML. Put a link with the sort param in the column headers and be done.
Re: HTML Can Do That
#75Re: HTML Can Do That
#76Most people use divs for everything now. This is a breath of fresh air.
With the exception of using divs for things that have a more appropriate element. Buttons for example - for the love of all that is holy - when I see an onclick handler and aria attributes on divs, I think, "couldn't you have restyled the button??"
Re: HTML Can Do That
#77Just 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.
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.
Re: HTML Can Do That
#78Just 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.
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.
FWIW I find the native date picker to also still be quite poorly performing in practice, despite quite robust browser support. I wish it worked better but for many reasons, I still see plenty of users (or bots?) who submit dates in the wrong format for whatever reason. My current hypothesis is largely focused on password managers though since they will often do whatever they want directly in the value attribute of an input element.
Re: HTML Can Do That
#79Re: HTML Can Do That
#80The “hidden until found” feature surprised me. What’s the use case for something like that?