This was a fun little read. Just through testing the examples, I also learned datalist does not seem to work well on mobile safari (which is a large enough market I might even say there’s essentially no scenario in which it’s worth using if there’s a compatibility issue).
The datalist examples definitely work on my iPhone. They integrate into the autocomplete suggestions above the native iOS keyboard. There’s no way to browse <i>all</i> the suggestions, but I suppose that’s not an intended use case for datalist.<p>However, the disabled attr on group definitely does <i>not</i> work!
It seems the autofill bar only populates with the first three items in the datalist and also does not clear when navigating to a regular text field like this one. Kind of an interesting way to have screwed it up.
That’s funny, in my case it tries to autofill my contact information
Mind that <i>input + datalist</i> is the HTML equivalent of the Windows combobox, once generally regarded as the worst UI element ever. (This was enjoying meme status in usability related articles and write-ups. So probably not a recommendation.)
Doesn't work with Firefox on Android either.
Way back when I was working my first job, datalist didn’t work on Firefox. That’s what got Firefox removed from the list of supported browsers.<p>It has been a problem for a long time if you want to support anything other than Chrome.
They work well but not with GBoard on iOS.
>What if there’s a bunch of options, but for [reasons] we don’t want a user to be able to select a subset of them? Let’s add the disabled attribute to an optgroup<p>Seems broken in mobile safari, not actually disabled I can still select the disabled items.
this was a dope & comprehensive.<p>unfortunately we have a new class of dev's that never learned html but went straight for React. Now with LLMs they will never learn HTML.<p>hence they reach for react components where simple html would have been sufficient.
I think that’s OK.<p>When I first had to use XML, I had to learn the XML spec and output it manually - serialization libraries didn’t really exist yet. I’ve since seen generation of juniors come up through the ranks using XML as an interchange format (and then JSON) without ever learning it fully. It was fine, and nothing terrible happened.<p>I’ve seen AJAX go from the hot new thing to people not knowing what it stood for, to now most people not even recognizing the term. AJAX didn’t die; it became so common we don’t need a word for it anymore.
Kind of like JQuery. I know why it was such an incredible library <i>and</i> am happy no new devs I work with (a) know what it is (b) understand why it was necessary.<p>Thank god the underlying language, libraries, and browser support have moved forward. And IE6 is dead. God, what a nightmare.
To be honest HTML is a pain.<p>For example the HTML approach to style parts of a control is to use pseudoclasses. Sometimes the selectors are different across browsers! Then you have to test across browsers because who knows if it will actually work correctly.<p>React is not just easier it's more dependable. If I make something with React and some divs I know it's going to work the same in all browsers.
Good stuff, except don't get too excited about `datalist`. It just doesn't have enough hooks to be actually useful for anything other than a little prototype.
Only if we had designers who like the default datalist appearance...
TIL <menu>, I wonder why more frameworks don't make use of it.
big brain no learn hyperspeak when many div do trick
<menu>, <dialog>, lots of fun stuff in html now.<p>I like to ask people what they imagine <ruby> does, because I certainly didn't guess right.
HTML linters actually help distinguish things like that? I'm curious if there are any linters out there that can enforce this kind of semantic tag selection.
Lots of useful information I wasn't aware of after being a front-end lead for years. I'll start using these at work for sure.
And yet, no native select + search combined, which is a very common kind of list. The datalist is basically unusable, because you don't know any of the options.
This is how real HTML magic should look like:<p><MARQUEE><p><pre><code> <OL>
<LI>One</LI>
<LI>Two</LI>
<LI>Three</LI>
</OL>
</code></pre>
</MARQUEE>
Now i need one that explains the css counters
Sigh. Just when I was cheering Safari, finally both on Desktop and on Mobile have gotten to the point of good enough.<p>And then to find out the list don't work on Safari iOS.
What I always wanted to know about lists and never dared to ask!
tl;dr: You _do_ know HTML lists, they're basicaly like they used to be 20 years ago. But there are HTML form controls which are list-like and this will tell you about them: <select> and <datalist> which have <option> elements and <menu> which has <li> elements.<p>It's a nice read, not very long and you can kind of leisurely skim it.
That’s a really good article. It’s nice to see something which isn’t slop.
Somehow I'm still in the mode where I'm surprised where it is, rather than when it isn't, but yeah it's annoyingly often. Do you come across it so much that it's your default expectation now?
Title reminds me of Joni Mitchell.<p><pre><code> I've looked at lists from both sides now
From give and take and still somehow
It's HTML lists' illusions I recall
I really don't know HTML lists at all</code></pre>
[dead]