Tech
The Dropdown You've Been Faking for a Decade
Design wants a country picker. Nothing fancy — a dropdown, a small flag icon next to each name. You reach for <select> , type the first <option> , and hit the wall every frontend dev hits eventually: an <option> can only ever show text. No <img> , no icon span, nothing. The browser renders whatever markup you put inside it as a plain string.
So you do what everyone does. You build a fake one.
The dropdown you build instead
A <div role="listbox"...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to