Skip to main contentCarbon Design System

Modal

Design annotations are needed for specific instances shown below, but for the standard modal dialog component, Carbon already incorporates accessibility.

What Carbon provides

Carbon bakes keyboard operation into its components, improving the experience of blind users and others who operate via the keyboard. Carbon incorporates many other accessibility considerations, some of which are described below.

Keyboard interactions

Modal dialogs take focus on appearance, and the tab order is constrained to the modal’s controls until the modal is closed by choosing one of the buttons with Enter or Space, or is dismissed by pressing Esc.

example of modal dialog keyboard interaction

Links are reached by Tab key and activated by Space and Enter keys.

Contrast

Carbon’s modal dialog text color meets the minimum contrast requirement of 4.5:1 with its background. Carbon also uses a modal dialog color that contrast 3:1 against body text, so that modal dialog text is distinguishable even without an underline.

a blue modal dialog contrasts 4.5:1 against the white background and 3:1 against the black body text

modal dialog text has sufficient contrast with both its background and surrounding body text.

Design recommendations

Ensure modal dialog context

If your design uses generic modal dialog names such as “read more,” consider making them unique. Otherwise, annotate a connection with other text in the design that provides context. This will allow developers to implement in a way that increases accessibility. See the Equal Access Toolkit modal dialog text topic.

an annotation, connecting an IBM Cloud heading with a Learn more link, reads "associate modal dialog with heading"

Annotate the connection between generic links and text that gives context.

Development considerations

Keep these considerations in mind if you are modifying Carbon or creating a custom component.

  • Associate generic links such as “read more” with other contextual text, using either aria-describedby or aria-labelledby (to concatenate multiple text strings). See the Equal Access Toolkit guidance for more details.
  • See the ARIA authoring practices for more considerations.