ARIA Attributes and Roles Guide
Overview
This document outlines the ARIA (Accessible Rich Internet Applications) implementation in the Understated theme. All interactive components are designed to be accessible to users with assistive technologies.
Core Components
Forms
- Form components use proper ARIA roles and states
- Error messages are announced using
aria-live
- Form controls have associated labels and descriptions
- Required fields are marked with
aria-required
- Error states use
aria-invalid
andaria-errormessage
<Form aria-label="Contact form">
<FormItem>
<FormLabel htmlFor="email">Email</FormLabel>
<Input
id="email"
type="email"
required
aria-describedby="email-description"
aria-errormessage="email-error"
/>
<FormDescription id="email-description">
We'll never share your email.
</FormDescription>
<FormMessage id="email-error" />
</FormItem>
</Form>
Cards and Regions
- Cards use the
region
role when containing important content - Regions have proper labeling via
aria-labelledby
oraria-label
- Content sections use semantic HTML5 elements with ARIA roles
<Card
role="region"
aria-labelledby="card-title"
>
<Heading id="card-title">Card Title</Heading>
<p>Card content...</p>
</Card>
Navigation
- Navigation uses proper landmark roles
- Current page is indicated with
aria-current
- Menu items use proper ARIA roles
- Skip links are provided for keyboard users
<nav role="navigation" aria-label="Main">
<ul role="menubar">
<li role="none">
<a role="menuitem" aria-current="page">
Current Page
</a>
</li>
</ul>
</nav>
Best Practices
Landmarks
- Use proper landmark roles:
banner
for headermain
for main contentnavigation
for navcontentinfo
for footercomplementary
for asidessearch
for search functionality
Live Regions
- Use
aria-live
appropriately:assertive
for important updatespolite
for less critical updates- Only use when necessary
Focus Management
- Visible focus indicators
- Logical tab order
- No keyboard traps
- Skip links for main content
Form Controls
- All inputs have labels
- Error messages are associated
- Required fields are marked
- Groups are properly labeled
Testing
- Use screen readers
- Test keyboard navigation
- Verify ARIA attributes
- Check focus management
- Test with assistive technologies
Resources
accessibility
aria
documentation