For as long as moonlight has kissed the darkened night sky, front-end web developers have been creating hacky and cumbersome "typeaheads". Some people know these components as "autocompletes". Most of us know them as PITA (see Urban Dictionary).
There has been a semi-perfect solution in native HTML that has existed for millenia (Internet Explorer 10): the
datalist is such a noble and proud element. It has stuck around through years of abandonment and abuse, watching
JS take all the credit for functionality it has provided since its conception.
More recently, web components and their fill-in libraries have tried to make commonplace what
datalist was meant for all along: being a native typeahead.
datalist has weak spots that the partnership of
JS have exploited again and again.
options cannot be styled
options cannot take additional HTML
- It provides no event API for filtering a list
Why the WHATWG has neglected
datalist? I honestly don't know.
It gets a small blurb in their docs:
And for the W3C it appears in one line under the
list attribute on their site:
So WHATWG, in the age of evergreen browsers, what the actual F are you doing??! Fix the above weaknesses. Give developers a native typeahead instead of forcing us to adopt newer tech like web components and shadow DOM.
Many, many front-end developers