A combobox is a text input joined to a pop-up list of options: you type to filter the list, or open it to browse, and pick a value with the mouse or the keyboard. You'll build the editable ARIA combobox pattern in React over a fixed list of eight programming languages — the interesting part is the keyboard: an "active" option that moves independently of what's typed.
The starter App.tsx renders the input and its ▾ toggle in the resting state (empty, listbox closed). Make it interactive:
▾ button opens or closes the listbox showing every option, regardless of the text.ArrowDown and ArrowUp move a highlighted "active" option through the filtered list and wrap at the ends. This highlight is separate from the input text — nothing is filled until you commit.Enter fills the input with the active option and closes; clicking an option does the same; Escape closes without changing the input.role="combobox" with aria-expanded and aria-activedescendant; the list is role="listbox"; each option is role="option" with aria-selected.ru — the listbox opens showing Rust and Ruby. ArrowDown highlights Rust; ArrowDown again highlights Ruby; once more wraps back to Rust.Rust highlighted, Enter fills the input with Rust and closes the list.▾ toggle on the empty box — all eight options appear. Escape closes them and leaves the input untouched.aria-activedescendant) tracks keyboard focus; nothing is selected until Enter or a click. Keep them as separate ideas.% operator does this in one line.▾ button re-opens the full list so a user can browse after they've already picked.styles.css; focus on the state and the key handling.Unlock the solution & editor
Runnable editor + tests
Solve in the browser with instant Jest feedback.
Detailed solutions
Walkthroughs, edge cases, and complexity notes.
Multi-framework variants
React, Vue, Vanilla, Angular — same question, different stacks.