Select-Style Custom Dropdowns
You'll learn how to build accessible custom select dropdowns that behave like native <select> elements using proper ARIA roles and keyboard interactions.
What Makes a Select Dropdown Different?
While menu dropdowns (which you just learned) execute commands, select dropdowns let users choose a value from a list—like picking your country or favorite color. Think of a menu as a restaurant menu where clicking performs an action, versus a select dropdown as a form where you're filling in a blank.
The key difference: select dropdowns use the listbox role (not menu), and their children use option roles (not menuitem).
The Semantic Structure
A custom select dropdown needs:
<div role="combobox" aria-expanded="false" aria-controls="color-listbox">
<button type="button" aria-labelledby="color-label">
Choose a color
</button>
</div>
<ul role="listbox" id="color-listbox" aria-labelledby="color-label">
<li role="option" aria-selected="false">Red</li>
<li role="option" aria-selected="true">Blue</li>
<li role="option" aria-selected="false">Green</li>
</ul>
The combobox role wraps the trigger button and identifies this as a selection widget. Each option uses aria-selected to indicate the current choice.
Keyboard Behavior
Users navigate with arrow keys to move between options, Enter or Space to select, and Escape to close without changing. Unlike menus, focus typically stays on the trigger button while the listbox is announced to screen readers.
Selection Management
When an option is chosen, update aria-selected="true" on the new choice and false on the old one. Update the button's visible text to reflect the selection.
Key Takeaway: Custom select dropdowns use combobox, listbox, and option roles with aria-selected to create accessible form controls that mirror native <select> behavior for screen readers and keyboard users.