17 comments

  • appplication4 hours ago
    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).
    • tshaddox1 hour ago
      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!
      • king_geedorah53 minutes ago
        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.
      • appplication1 hour ago
        That’s funny, in my case it tries to autofill my contact information
    • masswerk2 hours ago
      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.)
    • VorpalWay2 hours ago
      Doesn&#x27;t work with Firefox on Android either.
    • MattGaiser4 hours ago
      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.
      • Levitating2 hours ago
        &gt; It has been a problem for a long time if you want to support anything other than Chrome.<p>That&#x27;s partially because Chrome keeps adopting standards nobody else wants to support.
        • afavour2 hours ago
          Both things can be true. Chrome supports a bunch of non standard APIs but it also has some of the best coverage of standard APIs.
    • carlosjobim3 hours ago
      They work well but not with GBoard on iOS.
  • VladVladikoff4 hours ago
    &gt;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.
    • p2detar4 hours ago
      Not broken, but strange since it should be working on latest Safari.<p><a href="https:&#x2F;&#x2F;caniuse.com&#x2F;mdn-html_elements_optgroup_disabled" rel="nofollow">https:&#x2F;&#x2F;caniuse.com&#x2F;mdn-html_elements_optgroup_disabled</a><p>I think it may be a Safari bug.
      • quantumleaper3 hours ago
        Your link states it&#x27;s not supported in iOS Safari at all, even though it has been supported in macOS Safari since 2013.
        • p2detar2 hours ago
          Ha! You&#x27;re right. Ironically, I was viewing it on my phone and I only saw the &quot;Safari&quot; column and not &quot;Safari on iOS&quot;.
      • tvmalsv3 hours ago
        Came here to mention the same thing. Very well be on me, tho. I’m using the Brave browser (is it safari-powered?) and on iOS 18.7.9, which is the newest my old iPhone X supports.
        • somewhatgoated3 hours ago
          I think on iphone everything is safari powered(?)<p>Also doesnt work for me on iPhone Firefox
  • dzonga3 hours ago
    this was a dope &amp; comprehensive.<p>unfortunately we have a new class of dev&#x27;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.
    • Ancapistani2 hours ago
      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.
      • tyre30 minutes ago
        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.
        • Ancapistani20 minutes ago
          I remember when IE6 was the shiny new <i>solution</i> that we desperately wanted :).<p>IE 5.5 was much, much worse, and there was a long time there when it didn’t get any updates at all.
    • zarzavat1 hour ago
      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&#x27;s more dependable. If I make something with React and some divs I know it&#x27;s going to work the same in all browsers.
  • montroser4 hours ago
    Good stuff, except don&#x27;t get too excited about `datalist`. It just doesn&#x27;t have enough hooks to be actually useful for anything other than a little prototype.
    • voidnap2 hours ago
      I&#x27;ve used a datalist for autocomplete suggestions and it&#x27;s worked great.
      • theandrewbailey1 hour ago
        I&#x27;ve had problems with &lt;datalist&gt; not showing when the input is misspelled, or when none of the &lt;options&gt; strictly begin with the input. I gave up and used an &lt;ol&gt; instead.
    • iammrpayments4 hours ago
      I think I’ve tried building a combobox using datalist once but it didn’t work
      • bombcar3 hours ago
        As you learn more about “raw” html you find all sorts of very fun things that are - ah - not very well implemented if at all.
        • jazzypants2 hours ago
          The neat thing about HTML is that it&#x27;s a living standard and anyone can contribute. Old bugs get corrected all the time simply because it annoyed a certain person enough for them to push a fix through the standards process.<p>Unfortunately, it could be around a decade before all three major browsers finally implement the standard, and the fix might not be quite as clean as you originally imagined.
  • tuzemec32 minutes ago
    Only if we had designers who like the default datalist appearance...
  • nektro2 hours ago
    TIL &lt;menu&gt;, I wonder why more frameworks don&#x27;t make use of it.
    • pphysch2 hours ago
      big brain no learn hyperspeak when many div do trick
    • stirfish1 hour ago
      &lt;menu&gt;, &lt;dialog&gt;, lots of fun stuff in html now.<p>I like to ask people what they imagine &lt;ruby&gt; does, because I certainly didn&#x27;t guess right.
  • jdw644 hours ago
    HTML linters actually help distinguish things like that? I&#x27;m curious if there are any linters out there that can enforce this kind of semantic tag selection.
    • wonger_2 hours ago
      Closest thing I know of is <a href="https:&#x2F;&#x2F;github.com&#x2F;kristoff-it&#x2F;superhtml#diagnostics" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kristoff-it&#x2F;superhtml#diagnostics</a><p><pre><code> SuperHTML validates not only syntax but also element nesting and attribute values. No other language server implements the full HTML spec in its validation code.</code></pre>
  • jimmaswell4 hours ago
    Lots of useful information I wasn&#x27;t aware of after being a front-end lead for years. I&#x27;ll start using these at work for sure.
  • WA3 hours ago
    And yet, no native select + search combined, which is a very common kind of list. The datalist is basically unusable, because you don&#x27;t know any of the options.
  • reconnecting4 hours ago
    This is how real HTML magic should look like:<p>&lt;MARQUEE&gt;<p><pre><code> &lt;OL&gt; &lt;LI&gt;One&lt;&#x2F;LI&gt; &lt;LI&gt;Two&lt;&#x2F;LI&gt; &lt;LI&gt;Three&lt;&#x2F;LI&gt; &lt;&#x2F;OL&gt; </code></pre> &lt;&#x2F;MARQUEE&gt;
    • recroad4 hours ago
      <p><pre><code> &lt;BLINK&gt; &lt;MARQUEE&gt; &lt;OL&gt; &lt;LI&gt;One&lt;&#x2F;LI&gt; &lt;LI&gt;Two&lt;&#x2F;LI&gt; &lt;LI&gt;Three&lt;&#x2F;LI&gt; &lt;&#x2F;OL&gt; &lt;&#x2F;MARQUEE&gt; &lt;&#x2F;BLINK&gt; </code></pre> FTFY
      • Trufa3 hours ago
        blink wont work, but marquee will
        • wwweston3 hours ago
          Not with that attitude:<p><pre><code> &lt;style&gt; @keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } } blink { animation: blink 0.7s infinite; } &lt;&#x2F;style&gt; &lt;blink&gt;This guy blinks.&lt;&#x2F;blink&gt;</code></pre>
          • reconnecting2 hours ago
            What version of Macromedia Dreamweaver did you use to make this?
          • Trufa3 hours ago
            people who use css are not welcome here.
            • Ancapistani2 hours ago
              It’s OK if it’s a polyfill.<p>Wait, not far enough back…<p>It’s OK if it’s a shim.
        • reconnecting2 hours ago
          Since &lt;BLINK&gt; is gone, `BEHAVIOR=SLIDE` is the closest you&#x27;ll get.<p>&lt;MARQUEE DIRECTION=&quot;DOWN&quot; BEHAVIOR=&quot;SLIDE&quot;&gt;Slide&lt;&#x2F;MARQUEE&gt;
      • reconnecting4 hours ago
        &lt;MARK&gt;FTFY&lt;&#x2F;MARK&gt;
  • ale42 minutes ago
    Now i need one that explains the css counters
  • ksec2 hours ago
    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&#x27;t work on Safari iOS.
  • zombot4 hours ago
    What I always wanted to know about lists and never dared to ask!
  • einpoklum3 hours ago
    tl;dr: You _do_ know HTML lists, they&#x27;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: &lt;select&gt; and &lt;datalist&gt; which have &lt;option&gt; elements and &lt;menu&gt; which has &lt;li&gt; elements.<p>It&#x27;s a nice read, not very long and you can kind of leisurely skim it.
  • MagicMoonlight4 hours ago
    That’s a really good article. It’s nice to see something which isn’t slop.
    • lucb1e2 hours ago
      Somehow I&#x27;m still in the mode where I&#x27;m surprised where it is, rather than when it isn&#x27;t, but yeah it&#x27;s annoyingly often. Do you come across it so much that it&#x27;s your default expectation now?
  • asveikau4 hours ago
    Title reminds me of Joni Mitchell.<p><pre><code> I&#x27;ve looked at lists from both sides now From give and take and still somehow It&#x27;s HTML lists&#x27; illusions I recall I really don&#x27;t know HTML lists at all</code></pre>
    • ale3 hours ago
      I thought of the 2000 version first which made this much funnier in my head
  • ShivamNayak111 hour ago
    [dead]