Foundation: Radix UI primitives
Apsara components are built on top of Radix UI primitives, which provide:- ARIA compliance - Proper ARIA attributes and roles
- Keyboard navigation - Full keyboard support out of the box
- Focus management - Smart focus handling for complex components
- Screen reader support - Semantic HTML and announcements
Radix UI handles the complex accessibility patterns so you can focus on building your application.
ARIA attributes
All interactive components include appropriate ARIA attributes:Example: Button states
Example: Accessible icons
Provide text alternatives for icon-only buttons:Example: Form controls
Properly associate labels with form inputs:Keyboard navigation
Apsara components support standard keyboard interactions:Interactive elements
Key
Move focus to the next interactive element
Key
Move focus to the previous interactive element
Key
Activate buttons, links, and submit forms
Key
Activate buttons and toggle checkboxes
Key
Close dialogs, popovers, and dropdowns
Component-specific shortcuts
Dialogs
Dialogs
Esc- Close dialog- Focus is trapped within the dialog
- Focus returns to trigger element on close
Tabs
Tabs
←/→- Navigate between tabsHome/End- Jump to first/last tabTab- Move focus into tab panel
Radio groups
Radio groups
↓/↑- Select next/previous optionSpace- Select focused option
Accordion
Accordion
Space/Enter- Toggle panel↓/↑- Navigate between headersHome/End- Jump to first/last header
Focus management
Components handle focus states properly with visible indicators:button.module.css
- Shows focus indicator for keyboard navigation (
:focus-visible) - Hides focus indicator for mouse clicks (
:focus) - Uses theme-aware colors for the outline
Focus trap
Modal components like Dialog automatically trap focus:Screen reader support
Visually hidden text
Use the.sr-only class for screen reader-only content:
.sr-only utility class (from badge.module.css):
Live regions
Announce dynamic content changes:Semantic HTML
Apsara components use semantic HTML elements:Color contrast
Apsara’s default themes meet WCAG AA standards (4.5:1 contrast ratio for normal text):Color variants
Semantic color variants maintain accessibility:Motion and animations
Respect user’s motion preferences:Form accessibility
Validation and errors
Associate error messages with form fields:Required fields
Indicate required fields clearly:Testing accessibility
Automated testing
Use tools like axe or jest-axe:Manual testing
Test with real assistive technologies:- Keyboard navigation - Navigate your app using only Tab, Enter, Space, and Arrow keys
- Screen readers - Test with NVDA (Windows), JAWS (Windows), or VoiceOver (macOS/iOS)
- Zoom - Test at 200% zoom to ensure content remains readable
- High contrast mode - Test with Windows High Contrast or browser extensions
Best practices
Use semantic HTML
Choose the right HTML element for the job (button vs div, nav vs div, etc.)
Provide text alternatives
Add alt text for images and aria-label for icon buttons
Maintain focus order
Ensure tab order follows visual layout
Test with users
Include people with disabilities in user testing
Document shortcuts
List keyboard shortcuts in your app’s help section
Avoid ARIA overuse
Use native HTML features first, ARIA as enhancement
Resources
Radix UI
Learn about the accessible primitives Apsara is built on
WCAG Guidelines
Web Content Accessibility Guidelines reference
ARIA Authoring Practices
Design patterns and widgets using ARIA
WebAIM
Accessibility training and resources
Common patterns
Skip links
Add skip links for keyboard users:Loading states
Announce loading states to screen readers:Data tables
Use proper table markup:Related resources
Styling
Learn about focus states and visual indicators
Dark mode
Ensure accessibility in both light and dark themes