Skip to main contentCarbon Design System

Button

How it works

The Carbon button components are used to trigger an action or event, such as submitting a form, opening a modal, canceling an action, or performing an add or delete operation. The button uses tabindex="0" to ensure it is in the tab order. When the button has focus, Space key as well as Enter key activates the button. A button identified as disabled has aria-disabled set to true and is ignored in the tab order. By default, the button’s accessible name is computed from any text content inside the button element.

Accessibility considerations

This component has been validated to meet the WCAG 2.1 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. The button can be activated using both the Space or Enter key.
  2. The button should have text or label that accurately describes the action of the button.
  3. If a description of the button’s function is present, the button element should have an aria-describedby set to the ID of the element containing the description.
  4. After the button is activated ensure the focus is set correctly based on the type of action the button performs. See W3C WAI-ARIA Authoring Practices Button Design Pattern for a list of examples.

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. Tab to the first button, VO announces, "The button label"
  2. Clicking the Enter or Space key activates the button
- macOS Mojave version 10.14.6 with VoiceOver
- Safari version 13.0.2
- Carbon React version 7.7.1
VoiceOver(VO) test:
  1. Tab to the first button, VO announces, "The button label"
  2. Clicking the Enter or Space key activates the button

Windows screen reader tests

Environment
Results
- Microsoft Windows 10
- Firefox version 67
- JAWS 19.1810.64
- Carbon React version 7.7.1
JAWS test:
  1. Tab to the first button, JAWS announces, "The button label"
  2. Clicking the Enter or Space key activates the button.
- Microsoft Windows 10
- Chrome Version 73.0.3683.68 (Official Build) (64-bit)
- JAWS Version 19.1810.64
- Carbon React version 7.7.1
JAWS test:
  1. Tab to the first button, JAWS announces, "The button label"
  2. Clicking the Enter or Space key activates the button.
- Microsoft Windows 10
- Chrome Version 73.0.3683.68 (Official Build) (64-bit)
- NVDA Version 2018.4.1
- Carbon React version 7.7.1
NVDA test:
  1. Tab to the first button, NVDA announces, "The button label"
  2. Clicking the Enter or Space key activates the button.

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. Tab to the first button, VO announces, "The button label"
  2. Clicking the Enter or Space key activates the button.

Android screen reader tests

Environment
Results
- Android version 9 with Talkback
- Chrome version 72.0.3683.68 (Official Build) (64-bit)
- Carbon React version 7.7.1
Talkback test:
  1. Tab to the first button, Talkback announces, "The button label"
  2. Clicking the Enter or Space key activates the button.