Filterable select: focus and keyboard behavior options

This page simulates three possible keyboard/focus models for filterable select using plain HTML, ARIA and JS, so they can be compared in any browser and with assistive technology. It is not the native feature. See also w3c/aria#2841.

Legend: virtual focus (:active-option / aria-activedescendant) real DOM focus (:focus-visible) ✓ = selected

Keyboard summary

KeyOption 1: active-option + focusable optionsOption 2: active-option onlyOption 3: real focus moves to options
Typing in text fieldFilters options. Clears any active option.
ArrowDown in text fieldMoves the active option (focus stays in text field)Moves DOM focus to the first visible option
ArrowUp in text fieldMoves active option up; from the first option, clears it (back to "text editing")Default text field behavior
Enter in text fieldSelects/toggles the active optionNothing
Left/Right/Home/End/Escape in text fieldClears the active option (and Left/Right/Home/End do their normal caret movement)Default text field behavior
Tab from text fieldFocuses an option in the listboxLeaves the widgetFocuses an option in the listbox
Arrows in listboxMove DOM focus between options; ArrowUp on first option returns to text fieldn/a (listbox not focusable)Move DOM focus between options; ArrowUp on first option returns to text field
Leaving the text field (Tab, click elsewhere)Clears the active optionn/a
Space / Enter in listboxSelect/toggle focused optionn/aSelect/toggle focused option
Printable characters in listboxTypeaheadn/aConfigurable: typeahead, or redirect to text field
Clicking an optionSelects/toggles; focus moves to optionSelects/toggles; focus stays in text fieldSelects/toggles; focus moves to option

Native prototype

Only works in Chromium with chrome://flags/#enable-experimental-web-platform-features. The prototype implements Option 1. In other browsers this renders as an unrelated text field and listbox.