Accessibility Guide
Temper is built on top of Radix UI's Dialog primitive to ensure WCAG 2.1 compliance and screen reader support out of the box.
Key Accessibility Features
-
Screen Reader Announcements:
Drawer.Titlesets thearia-labelledbyattribute on the dialog element.Drawer.Descriptionsets thearia-describedbyattribute on the dialog element.
-
Focus Management:
- When opened, focus is automatically trapped inside the active drawer.
- Initial focus goes to the first focusable element inside
<Drawer.Content>. - When closed, focus is automatically restored to
<Drawer.Trigger>.
-
Keyboard Controls:
- Pressing
Escapecloses the open drawer. - Pressing
Tabcycles focus strictly inside the open drawer.
- Pressing
-
Touch Target Size:
<Drawer.Handle />includes a hidden hit target extension (data-temper-handle-hitarea) ensuring a minimum 44x44px touch target on touchscreens, meeting WCAG Target Size guidelines.
Best Practices
[!IMPORTANT] Always include
<Drawer.Title>inside<Drawer.Content>. If you wish to visually hide the title while preserving screen reader accessibility, apply a screen-reader-only CSS class (sr-only/visually-hidden).
<Drawer.Title className="sr-only">
Navigation Drawer
</Drawer.Title>