On this page

Drawer

Keys, what Drawer gives you and what your team does.

Conformance

Drawer meets WCAG 2.2 level AA when used as described on these pages. It follows the Dialog (Modal) pattern of the WAI-ARIA Authoring Practices.

Keyboard

Key Action
Tab Moves to the next control in the drawer. From the last one, goes back to the first.
Shift + Tab Moves to the previous control in the drawer.
Esc Closes the drawer. Focus goes back to the button that opened it.

What Drawer gives you

  • role="dialog" and aria-modal="true", named by DrawerTitle and described by DrawerDescription.
  • Focus moves into the drawer when it opens, stays inside, and goes back to the trigger when it closes.
  • Closing with Esc and with a click on the scrim, as well as with a swipe.

What your team does

  • Always put a visible Cancel or Close button in the drawer. A swipe is a path gesture; people who can’t swipe need a single tap (WCAG 2.5.1, 2.5.7).
  • Always give the drawer a DrawerTitle. If the design has no visible title, keep it with class="sr-only".
  • Keep the content short enough to read without scrolling inside the drawer.

WCAG criteria

Criterion Level How
2.1.1 Keyboard A Every part works with the keyboard; Esc closes
2.4.3 Focus Order A Focus moves in on open and back to the trigger on close
2.5.1 Pointer Gestures A A Close or Cancel button does what the swipe does
2.5.7 Dragging Movements AA The same button: no drag is needed
4.1.2 Name, Role, Value A role="dialog", aria-modal, named by the title