Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Isn't the proper solution to just use the HTML <select> element, instead of one that recreates the visual, recreates the behavior with JavaScript, and recreates the semantics with ARIA?


<select> is terribly limiting. Options can be a single line of plain text, with some platforms letting you control colour and font, and you get only very basic selection by typing, on desktop platforms only in general.

The “Favorite Animal” dropdown shown in the linked page can be done with <select> with no loss, and therefore I’d say probably should be. But you can often do much better by skipping past <select>:

• Use more than just plain text in each option (very simple example: https://react-spectrum.adobe.com/react-aria/Select.html#comp... also think of things like adding icons)

• Support typing on all platforms (and no, native combo boxes à la <input list="…"> + <datalist> aren’t far off completely useless in practice).

• Support typing with more complex matching, e.g. in a country selector supporting US/USA/United States, NL/Netherlands/The Netherlands/Holland, &c.


Funny enough, all of those examples are broken on Firefox for Android; they show on tap, then immediately hide.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: