Overview
Dynamic UI is built with accessibility as a core principle. Every component includes ARIA attributes, keyboard navigation, focus management, and screen reader support to ensure WCAG 2.1 AA compliance.ARIA Attributes
All interactive components include appropriate ARIA attributes for screen reader compatibility.Button States
The DButton component automatically manages accessibility attributes:src/components/DButton/DButton.tsx
aria-label: Provides accessible name (especially important for icon-only buttons)aria-busy: Indicates loading state to screen readersaria-disabled: Announces disabled statearia-hidden="true": Hides decorative loading spinner from screen readersrole="status": Announces loading text as status update
Progress Indicators
src/components/DProgress/DProgress.tsx
Toast Notifications
src/components/DToast/DToast.tsx
role="alert": Identifies as important notificationaria-live="assertive": Screen readers interrupt to announcearia-atomic="true": Reads entire content on change
Tabs
src/components/DTabs/DTabs.tsx
List Groups
src/components/DListGroup/components/DListGroupItem.tsx
Keyboard Navigation
Dynamic UI provides comprehensive keyboard support for all interactive components.Focus Management
The portal system includes automatic keyboard trap for modals and overlays:src/contexts/DPortalContext.tsx
Keyboard Trap Benefits:
- Prevents focus from escaping modal dialogs
- Tab cycles through only focusable elements within the modal
- Shift+Tab works in reverse direction
- Escape key closes the top-most modal
Focusable Elements Detection
The library includes a utility to find all keyboard-accessible elements:src/utils/getKeyboardFocusableElements.ts
- Links (
<a>) - Buttons (
<button>) - Form inputs (
input,textarea,select) - Details/summary elements
- Elements with explicit
tabindex(excluding-1) - Excludes disabled elements
Input PIN Focus Management
The DInputPin component provides automatic focus progression:src/components/DInputPin/DInputPin.tsx
Modal and Offcanvas
tabIndex={-1}: Allows programmatic focus but not tab navigation to containerdata-bs-keyboard: Controls keyboard dismissal behavior
Screen Reader Support
Status Announcements
Components announce state changes to screen readers:Loading States
Select and input components include loading indicators:src/components/DInputSelect/DInputSelect.tsx
Form Validation
Inputs connect to validation messages viaaria-describedby:
src/components/DInputPin/DInputPin.tsx
Color Contrast
Dynamic UI ensures WCAG AA compliant color contrast ratios.Minimum Contrast Ratio
src/style/abstracts/variables/_colors.scss
Automatic Contrast Calculation
Text colors are automatically calculated for optimal contrast:- Measures the luminance of the background color
- Tests contrast against both light and dark text
- Returns the option meeting the minimum contrast ratio
Theme Color Contrasts
src/style/abstracts/variables/_colors.scss
Interactive Targets
All interactive elements meet the minimum touch target size.Button Sizing
Form Controls
Motion and Animation
Respects user preferences for reduced motion:Testing Accessibility
Jest-axe Integration
Dynamic UI includes jest-axe for automated accessibility testing:Storybook a11y Addon
All components are tested with the Storybook accessibility addon:package.json
- Real-time accessibility violation detection
- WCAG level filtering (A, AA, AAA)
- Detailed violation descriptions
- Element highlighting
Best Practices
Always provide labels
Always provide labels
Use
aria-label or aria-labelledby for all interactive elements, especially icon-only buttons:Manage focus order
Manage focus order
Ensure logical tab order by placing elements in DOM order. Use
tabIndex={-1} for containers that shouldn’t be in tab flow:Announce dynamic changes
Announce dynamic changes
Use
role="status" or aria-live regions for dynamic content updates:Test with keyboard only
Test with keyboard only
Navigate your entire application using only the keyboard:
- Tab through all interactive elements
- Activate with Enter/Space
- Close modals with Escape
- Navigate forms with arrow keys
Use semantic HTML
Use semantic HTML
Prefer native HTML elements over custom implementations:
- Use
<button>not<div onClick> - Use
<a>for navigation - Use
<input>,<select>for forms
WCAG 2.1 Compliance
Dynamic UI components meet WCAG 2.1 Level AA criteria:1.4.3 Contrast
Minimum 4.5:1 contrast ratio for normal text, 3:1 for large text
2.1.1 Keyboard
All functionality available via keyboard
2.1.2 No Keyboard Trap
Focus can move away from any component using keyboard
2.4.3 Focus Order
Focus order preserves meaning and operability
2.4.7 Focus Visible
Keyboard focus indicator visible with 2px outline
2.5.5 Target Size
Interactive targets minimum 44x44 CSS pixels
4.1.2 Name, Role, Value
All components have proper ARIA attributes
4.1.3 Status Messages
Status changes announced to assistive technologies
Resources
WCAG 2.1 Guidelines
Official WCAG quick reference
ARIA Authoring Practices
W3C ARIA patterns and widgets
WebAIM
Accessibility training and resources
axe DevTools
Browser extension for accessibility testing
Next Steps
Architecture
Learn about the micro frontend architecture
Theming
Customize colors while maintaining accessibility