Select

How it works

The select Carbon component is a form input field, where a user is submitting data and chooses a single option from a list of options. The label element is used to explicitly associate a form control with a label. A label is attached to a specific form control through the use of the for attribute. The value of the for attribute must be the same as the value of the id attribute of the form control. Also note that the id attribute may have the same value as the name attribute, but both must be provided, and the id must be unique in the Web page.

Accessibility considerations

This component has been validated to meet the WCAG 2.0 AA and Section 508 accessibility guidelines, however changes made by the content owner can affect accessibility compliance. Be sure to review and follow the guidance in this section when updating or adding new content to this component.

  1. Avoid very long option names to facilitate understandability and perceivability.
  2. Do not use the same word or phrase at the beginning of a set of options.
  3. Use a unique id for each option.
  4. If the select field is required include the aria-required property and indicate that it is a required field and use the validation message for input errors.

Resources

Accessibility testing

Accessibility issues are tracked in the Carbon Component GitHub repository.

Automated test

Automated test environment
Results
- macOS Mojave version 10.14.6 with VoiceOver
- Chrome version 77.0.3865.90
- Dynamic Assessment Plugin (DAP) version 1.8.0.0 - IBM Accessibility WCAG 2.1 Sept. 2019 Ruleset
- Carbon React version 7.7.1
DAP test:
- No violations

macOS screen reader tests

Environment
Results
- macOS Mojave version 10.14.6 with VoiceOver
- Chrome version 77.0.3865.90
- Carbon React version 7.7.1
VoiceOver(VO) Test:
  1. Control-Option-Right arrow to the "Select" text. VO announces the label and that it is a text element.
  2. Control-Option-Right arrow to the "Optional helper text". VO announces the label and that it is a text element.
  3. Control-Option-Right arrow to the select box. VO announces the label, "Choose an Option" and that it is a select pop-up button.
  4. Press the Space key. VO announces that you are on a dimmed menu item.
  5. Navigate up and down the menu using the arrow keys. VO announces each menu item.
  6. Press the Space key to make a selection.
  7. Tab away from the select box and then back. VO announces the selected option.
  8. Press Space to open the menu and then press Esc to close the menu.

Windows screen reader tests

Environment
Results
- Microsoft Windows 10
- JAWS 18
- Firefox version 68
- Carbon React version 7.7.1
JAWS test:
  1. Press Alt-Down arrow . JAWS announces the text, "Select, optional helper text".
  2. Tab to the select box. JAWS announces the main region, the select combo box and and that the arrow keys should be used to make a selection.
  3. Use the Up and Down arrow keys to navigate through the list. JAWS announces each option.
  4. Tab away from the select box and then back. JAWS announces the selected option.

iOS screen reader tests

Environment
Results
- iOS version 13.1.3 with VoiceOver
- Safari version 13.1.3
- Carbon React version 7.7.1
VoiceOver test:
  1. Swipe right, VO announces "Select main landmark".
  2. Swipe right, VO announces "Optional helper text".
  3. Swipe right to navigate to the select box. VO announces "Select. Choose an option pop-up button, double tap to activate the picker."
  4. Double tap to open the menu, VO does not announce anything. (Note: There is an open issue for VoiceOver on iOS.)