Skip to main content
Apsara is built with accessibility as a core principle. All components are designed to be keyboard navigable, screen reader friendly, and WCAG compliant.

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

  • Esc - Close dialog
  • Focus is trapped within the dialog
  • Focus returns to trigger element on close
  • / - Navigate between tabs
  • Home / End - Jump to first/last tab
  • Tab - Move focus into tab panel
  • / - Select next/previous option
  • Space - Select focused option
  • Space / Enter - Toggle panel
  • / - Navigate between headers
  • Home / End - Jump to first/last header

Focus management

Components handle focus states properly with visible indicators:
button.module.css
This pattern:
  • Shows focus indicator for keyboard navigation (:focus-visible)
  • Hides focus indicator for mouse clicks (:focus)
  • Uses theme-aware colors for the outline
Never remove focus indicators without providing an alternative visual cue. Focus indicators are essential for keyboard navigation.

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:
The .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):
When customizing colors, use a contrast checker to ensure WCAG compliance:
  • AA standard: 4.5:1 for normal text, 3:1 for large text
  • AAA standard: 7:1 for normal text, 4.5:1 for large text

Color variants

Semantic color variants maintain accessibility:

Motion and animations

Respect user’s motion preferences:
The ThemeProvider supports disabling transitions:

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:
  1. Keyboard navigation - Navigate your app using only Tab, Enter, Space, and Arrow keys
  2. Screen readers - Test with NVDA (Windows), JAWS (Windows), or VoiceOver (macOS/iOS)
  3. Zoom - Test at 200% zoom to ensure content remains readable
  4. 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

Add skip links for keyboard users:

Loading states

Announce loading states to screen readers:

Data tables

Use proper table markup:

Styling

Learn about focus states and visual indicators

Dark mode

Ensure accessibility in both light and dark themes