Select
Examples
To render a select, apply the class chi-select
to a select
.
Web Component
Properties
Web component coming soon
Accessibility
Keyboard Navigation
Key | Function |
---|---|
Tab | Moves focus to the next focusable element. |
Shift + Tab | Moves focus to the previous focusable element. |
Space ,Down Arrow | When focus is on the trigger, opens the dropdown. |
Up Arrow ,Down Arrow | Moves focus between the options in the dropdown. If focus is on the last/first option, moves focus to the first/last option respectively. |
Space ,Enter | Selects the option and closes the dropdown. |
Esc | Closes the dropdown and returns focus to the trigger. |
For comprehensive details on keyboard support, refer to our Keyboard Control Guide.
Visit WebAIM for keyboard techniques.
Find live examples in the A11y style guide.
Roles and attributes
The following list provides essential roles and attributes you should consider to ensure our components are fully accessible across various interface scenarios.
Attribute | Element | Usage |
---|---|---|
aria-label | div | Defines a string value that labels an interactive element. It is required props for select without text content. |
Resources
- Mozilla Resources for Developers: Information about the HTML select element.
- W3 Single-select Combobox: Single-select combobox widget that is functionally similar to an HTML
select
element. - MagentaA11y: How to test the select element.
Other recommendations
Explore additional accessibility tips in the general Accessibility Guide.
WCAG 2.2 Guidelines
- Non-text Content: All non-text content that is presented to the user has a text alternative that serves the equivalent purpose. (Level A)
- Info and Relationships: Information, structure, and relationships conveyed through presentation can be programmatically determined or are available in text. (Level A)
- Headings and Labels: Headings and labels describe topic or purpose. (Level AA)
- Labels or Instructions: Labels or instructions are provided when content requires user input. (Level A)
- Name, Role, Value: For all user interface components (including but not limited to: form elements, links and components generated by scripts), the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set; and notification of changes to these items is available to user agents, including assistive technologies. (Level A)