Drawer
A drawer is a panel that slides in from the right side of the screen. The Drawer is overlayed on top of the main area of the page to capture the user’s attention while keeping the context of the current task.
import { ... } from '@ag.ds-next/react/drawer';
Learn more about how to meet WCAG success criteria when implementing drawers. This makes them accessible and inclusive for users of all abilities and situations.
The drawer component passed accessibility testing in 2024.
Clear and descriptive buttons and links
Requirements
- Buttons and links have clear, concise and descriptive text.
- Button and link text should be unique and avoid generic phrases like ‘Click here’ or ‘Learn more’.
- If using more than one button or link, each is uniquely identifiable.
- Visible indication that a link opens in a new window, tab or drawer.
- Links have accessible names that indicate if they open in a new window, new tab or drawer.
Benefits
- Assistive technology users have equal access to information about the purpose of the link or button.
- All users can identify the purpose of the link or button.
- Supports users by providing clear expectations.
- Improves usability and reduces confusion over where links will lead.
WCAG references
- Understanding success criterion 2.4.4 Link purpose (in context)
- Understanding success criterion 3.2.4 Consistent identification
- Understanding success criterion 4.1.1 Parsing
- Understanding success criterion 4.1.2 Name, role, value
Content structure
Requirements
- Meaningful and logical sequence of content in the drawer.
- Information relationships in the drawer are logical and understood and conveyed by assistive technology.
- Headings clearly describe or introduce content.
- Use
h2
toh6
to identify headings in drawers. - Forms in the drawer have an
id
. - The primary button is
type="submit"
with aform
attribute whose value is the<form>
’sid
.
Benefits
- Creates a logical structure for screen reader navigation.
- Ensures content makes sense regardless of the technology used.
- Helps users understand the organisation and relationship of content.
- Makes the information easier to locate.
- Increases understanding of the content that comes next.
WCAG references
- Understanding success criterion 1.3.1 Info and relationships
- Understanding success criterion 1.3.2 Meaningful sequence
- Understanding success criterion 2.4.6 Headings and labels