Dropdown
Overview
A dropdown component and its variants multiselect and combo box are reached by Tab, with navigation of the options by Up and Down arrow keys. However, the keys for opening the component and selecting its options are different for each variant.
Dropdown
The default dropdown opens with Enter, Space, or Down arrow, with focus moving to the currently selected option. Arrow keys change options, and any option with focus is selected with Space or Enter, which also closes the dropdown. Pressing Esc or Tab closes a dropdown without changing the selected option.
Multiselect
The multiselect opens with the Enter or Space keys, which are also used to toggle the selection of any option. Once items are selected, a tag appears in the field, showing a numerical representation of the number of items selected along with an ‘x’. Pressing Esc closes the multiselect. Pressing Delete while focus is in the collapsed field will clear all selected options.
Combo box
Enter or the Up or Down arrow keys will open the list of options, as will typing any character or string of characters (which will also filter the list to only show items that match the typed string). Pressing Esc will clear the input and collapse the list. Pressing Enter will select a highlighted option and collapse the list. (If nothing is highlighted in the list, pressing Enter will toggle the combo box open and closed.) Space cannot be used for selecting, as pressing it will submit a space character into the filter string.
Design recommendations
Always use a label. Don’t replace it with the default menu option (for example, removing the “State” label and just having the menu read “Select a state” by default).
Development considerations
Avoid auto-submission. Don’t use JavaScript to automatically submit the form (or do anything else) when an option is selected. Auto-submission disrupts screen readers because they select each option as they read them.