235

HTML Lists

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).

3 hours agoappplication

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 all the suggestions, but I suppose that’s not an intended use case for datalist.

However, the disabled attr on group definitely does not work!

36 minutes agotshaddox

That’s funny, in my case it tries to autofill my contact information

29 minutes agoappplication

Mind that input + datalist 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.)

an hour agomasswerk

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.

It has been a problem for a long time if you want to support anything other than Chrome.

3 hours agoMattGaiser

> It has been a problem for a long time if you want to support anything other than Chrome.

That's partially because Chrome keeps adopting standards nobody else wants to support.

2 hours agoLevitating

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.

2 hours agoafavour

Doesn't work with Firefox on Android either.

an hour agoVorpalWay

They work well but not with GBoard on iOS.

2 hours agocarlosjobim

>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

Seems broken in mobile safari, not actually disabled I can still select the disabled items.

3 hours agoVladVladikoff

Not broken, but strange since it should be working on latest Safari.

https://caniuse.com/mdn-html_elements_optgroup_disabled

I think it may be a Safari bug.

3 hours agop2detar

Your link states it's not supported in iOS Safari at all, even though it has been supported in macOS Safari since 2013.

3 hours agoquantumleaper

Ha! You're right. Ironically, I was viewing it on my phone and I only saw the "Safari" column and not "Safari on iOS".

an hour agop2detar

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.

2 hours agotvmalsv

I think on iphone everything is safari powered(?)

Also doesnt work for me on iPhone Firefox

2 hours agosomewhatgoated

this was a dope & comprehensive.

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.

hence they reach for react components where simple html would have been sufficient.

2 hours agodzonga

I think that’s OK.

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.

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.

2 hours agoAncapistani

To be honest HTML is a pain.

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.

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.

42 minutes agozarzavat

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.

3 hours agomontroser

I've used a datalist for autocomplete suggestions and it's worked great.

an hour agovoidnap

I've had problems with <datalist> not showing when the input is misspelled, or when none of the <options> strictly begin with the input. I gave up and used an <ol> instead.

15 minutes agotheandrewbailey

I think I’ve tried building a combobox using datalist once but it didn’t work

3 hours agoiammrpayments

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.

2 hours agobombcar

The neat thing about HTML is that it'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.

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.

an hour agojazzypants

TIL <menu>, I wonder why more frameworks don't make use of it.

an hour agonektro

<menu>, <dialog>, lots of fun stuff in html now.

I like to ask people what they imagine <ruby> does, because I certainly didn't guess right.

14 minutes agostirfish

big brain no learn hyperspeak when many div do trick

an hour agopphysch

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.

3 hours agojdw64

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.

3 hours agojimmaswell

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.

2 hours agoWA

This is how real HTML magic should look like:

<MARQUEE>

  <OL>
      <LI>One</LI>
      <LI>Two</LI>
      <LI>Three</LI>
  </OL>
</MARQUEE>
3 hours agoreconnecting

    <BLINK>
      <MARQUEE>
        <OL>
          <LI>One</LI>
          <LI>Two</LI>
          <LI>Three</LI>
        </OL>
      </MARQUEE>
    </BLINK>
FTFY
3 hours agorecroad

blink wont work, but marquee will

2 hours agoTrufa

Not with that attitude:

    <style>
    @keyframes blink {
        0% { opacity: 1; }
        50% { opacity: 0; }
        100% { opacity: 1; }
    }
    
    blink { animation: blink 0.7s infinite; }
    </style>

    <blink>This guy blinks.</blink>
2 hours agowwweston

What version of Macromedia Dreamweaver did you use to make this?

2 hours agoreconnecting

people who use css are not welcome here.

2 hours agoTrufa

It’s OK if it’s a polyfill.

Wait, not far enough back…

It’s OK if it’s a shim.

2 hours agoAncapistani

Since <BLINK> is gone, `BEHAVIOR=SLIDE` is the closest you'll get.

<MARQUEE DIRECTION="DOWN" BEHAVIOR="SLIDE">Slide</MARQUEE>

an hour agoreconnecting

<MARK>FTFY</MARK>

3 hours agoreconnecting

Sigh. Just when I was cheering Safari, finally both on Desktop and on Mobile have gotten to the point of good enough.

And then to find out the list don't work on Safari iOS.

an hour agoksec

What I always wanted to know about lists and never dared to ask!

3 hours agozombot

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.

It's a nice read, not very long and you can kind of leisurely skim it.

2 hours agoeinpoklum

That’s a really good article. It’s nice to see something which isn’t slop.

3 hours agoMagicMoonlight

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?

an hour agolucb1e

Title reminds me of Joni Mitchell.

    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
3 hours agoasveikau

I thought of the 2000 version first which made this much funnier in my head