CSS 'appearance: base-select' lets developers style native dropdowns without rebuilding them
Frontend developers have long resorted to building custom dropdown components from scratch whenever designs require icons or rich styling inside select menus, since native HTML select elements can only render plain text. These hand-built alternatives introduce complex bugs, such as popup clipping caused by ancestor elements with overflow: hidden, and require manual scroll and resize listeners to stay positioned correctly. A bigger hidden cost is accessibility: native select elements provide keyboard navigation, type-ahead, screen reader announcements, and focus management for free, while most custom dropdowns only partially replicate this behavior. A new CSS property, appearance: base-select, now allows developers to style native select elements directly, including placing real markup like flag icons inside option elements, without sacrificing any built-in browser behavior. The feature also promotes the dropdown popup to the browser's top layer, eliminating clipping issues entirely; it is currently available in Chromium-based browsers, with Firefox and Safari support still in progress.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in