Select
On this page
Keyboard interactions
The select toggle and its options can be interacted with using the tab, arrow, space, and enter keys.
| Key | Result |
|---|---|
| Tab |
|
| Enter/Space |
|
| Down | Moves focus to the next interactive option |
| Up | Moves focus to the previous interactive option |
Focus order
A logical focus order helps keyboard users operate our websites. Elements need to receive focus in an order that preserves meaning, therefore the focus order should make sense and not jump around randomly.
Touch targets
All toggles and menu items exceed the WCAG Level AA success criteria for target size, which calls for touch targets to be at least 24px by 24px.
Validation and error state
The component does not set aria-invalid when you set state="danger". The state attribute (danger, warning, success) is for visual feedback only. To expose an invalid state to assistive technologies, implementors must set aria-invalid on the select themselves (and optionally use the Constraint Validation API).
This keeps a single source of truth for "invalid" in your code and avoids the component asserting "invalid" when you only meant visual emphasis. When you do have a validation error, set both the visual state and ARIA so screen reader users get the same information.
For how to combine state, aria-invalid, and the Constraint Validation API (including built-in required validation and custom validation), see Validation and error state on the Code page.
Additional guidelines
- If a select does not have an associated
- Each option requires a label attribute.
ARIA Authoring Practices Guide (APG)
Learn to use the accessibility semantics defined by the Accessible Rich Internet Application (ARIA) specification to create accessible web experiences.
Web Content Accessibility Guidelines
Automated testing
Some of our elements may receive errors or warnings that are false positives from automated testing tools. If you are experiencing some of these issues, please read our update on false positives in automated tools.
Understanding documents provide detailed explanations for Web Content Accessibility Guidelines (WCAG) guidelines and success criteria.
-
SC 2.1.1 Keyboard (Level A)
-
SC 2.1.3 Keyboard (no exception) (Level AAA)
-
SC 2.4.3 Focus order (Level A)
-
SC 2.5.5 Target size (Level AAA)
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.