How to build an accessible Drawer in React

Renders role="dialog" with aria-modal; the title labels it via aria-labelledby and the description via aria-describedby. FocusScope traps Tab focus and restores it on close; DismissableLayer handles Escape and outside-pointer dismissal.

When to use a Drawer

When not to use it

Keyboard interactions

Role dialog, verified at WCAG 2.2-AA.

Common mistakes

Avoid: <Drawer title="Delete item?">Are you sure?</Drawer>

Prefer: <AlertDialog title="Delete item?" />

A full edge panel with focus trap and scroll lock is overkill for a yes/no decision

Example

<Drawer open={isOpen} onOpenChange={setIsOpen} title="Settings">
  <SettingsForm />
</Drawer>

See the full Drawer reference →