Radio button

How it works

The radio button Carbon component is a radio group containing a set of checkable buttons, known as radio buttons where no more than one of the buttons can be checked at a time. In this example the first button is set to be selected by default. The tabindex="0" has been added to allows each button to receive keyboard focus placing the element in the logical navigation flow.

Accessibility considerations

  1. When a radio group does not have a default selected the focus should move to the first radio button in the group.
  2. Labels should be presented after the radio button.
  3. If the radio button is a required field include the aria-required property and indicate that it is a required field.

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 key to first radio button. VO announces the label, selected, radio button 1 of 3.
  2. Control-Option-Right arrow key to second radio button. VO announces the label, radio button 2 of 3.
  3. Space key selects and deselects the option.
  4. Control-Option-Right arrow key to disabled radio button. VO announces the label, dimmed radio button, 3 of 3.
- macOS Mojave version 10.14.6 with VoiceOver
- Safari version 13.0.2
- Carbon React version 7.7.1
VoiceOver(VO) test:
  1. Control-Option-Right arrow key to first radio button. VO announces the label, selected, radio button 1 of 3.
  2. Control-Option-Right arrow key to second radio button. VO announces the label, radio button 2 of 3.
  3. Space key selects and deselects the option.
  4. Control-Option-Right arrow key to disabled radio button. VO announces the label, dimmed radio button, 3 of 3.

Windows screen reader tests

Environment
Results
- Microsoft Windows 10
- JAWS 19.1810.64
- Chrome version 72.0.3626.96 (Official Build) (64-bit)
- Carbon React version 7.7.1
JAWS test:
  1. Use tab or shift tab to navigate in and out of the group box. When entering the group box, JAWS announces the title of the box, and the currently selected radio button together with it's status.
  2. Inside the group box, the user can use the arrow keys to navigate among the buttons, when JAWS changes the selection and announces the current button.
  3. The disabled radio button is not announced, only if the user exits forms mode and uses the down arrow key to navigate to it.
- Microsoft Windows 10
- NVDA version 2018.4.1
- Chrome version 72.0.3626.96 (Official Build) (64-bit)
- Carbon React version 7.7.1
NVDA test:
  1. Use tab or shift tab to navigate in and out of the group box. When entering the group box, NVDA announces the title of the box, and the currently selected radio button together with it's status.
  2. Inside the group box, the user can use the arrow keys to navigate among the buttons, when NVDA changes the selection and announces the current button.
  3. The disabled radio button is not announced, only if the user exits forms mode and uses the down arrow key to navigate to it.

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. Navigate the radio buttons by swiping left or right, or by pressing the left and right arrow keys when quick navigation is turned on.
  2. When entering the group box, VoiceOver announces, "radio button heading form start".
  3. The individual buttons are announced as,"radio button label radio button checked 1 of 3"
  4. VO announces the disabled radio button as "radio button label dimmed radio button unchecked".
  5. When double tapping on a radio button, it becomes activated and VoiceOver announces, "checked".
  6. When double tapping on the inactive button, voiceover announces its status.

Android screen reader tests

Environment
Results
- Android version 9 with Talkback
- Chrome version 72.0.3626.96 (Official Build) (64-bit)
- Carbon React version 7.7.1
Talkback test:
  1. Navigate the radio buttons by swiping left or right, or by pressing alt + the left and right arrow keys
  2. The individual buttons are announced as, "checked radio button label radio button"
  3. Disabled radio buttons are not indicated.
  4. When double tapping on a radio button, it becomes activated and Talkback announces: "not checked checked" or "checked not checked"
  5. Note: The user has to swipe away and back to make sure the button is set to the correct status.
  6. When double tapping on the inactive button, TalkBack randomly announces checked or unchecked.