Accessibility
Accessibility guidelines, utilities, and best practices
WCAG 2.2 checklist alignment
Rizzo aligns with the Web Accessibility Checklist (WCAG 2.2). Every checklist item (HTML, keyboard, forms, content, links, contrast, headings, images, media, ARIA, testing) is implemented or documented. Full prose and patterns: docs/ACCESSIBILITY.md (in repo). The key areas below are summarized on this page.
Accessibility Features
Rizzo CSS is built with accessibility as a core principle, following WCAG 2.1/2.2 guidelines.
Keyboard Navigation
All interactive components support full keyboard navigation:
- Tab navigation
- Arrow keys for menus
- Enter/Space for activation
- Escape to close/dismiss
ARIA Attributes
Components include proper ARIA attributes:
aria-label- Descriptive labelsaria-expanded- Menu/accordion statearia-controls- Element relationshipsaria-describedby- Additional descriptionsrole- Semantic roles
Focus Management
- Visible focus indicators using
--accent/--accent-fgcolor - Focus trapping in modals
- Focus restoration: when you close overlays (Search, Modal, Dropdown), focus returns to the trigger
- Skip links for main content
Utility Classes
Screen Reader Only
Hide content visually but keep it available to screen readers:
<span class="sr-only">Screen reader only text</span> Uses modern clip-path: inset(50%) instead of deprecated clip property.
Focusable Screen Reader Content
Make screen reader content focusable:
<a href="#content" class="sr-only sr-only-focusable">Skip to content</a> When focused, the content becomes visible and accessible.
Skip Links
Skip to main content link:
<a href="#main-content" class="skip-link">Skip to main content</a> Visually Hidden
Hide content completely:
<span class="visually-hidden">Hidden content</span> Focus Styles
All interactive elements have visible focus indicators:
:focus-visible {
outline: 2px solid var(--accent-fg);
outline-offset: 2px;
} Form Accessibility
Labels
Always use labels with form inputs:
<label for="email">Email</label>
<input type="email" id="email" name="email" /> Required Fields
<label for="name" class="required">Name</label>
<input type="text" id="name" name="name" required /> Error States
<input type="email" aria-invalid="true" aria-describedby="email-error" />
<span id="email-error" class="error-message">Invalid email address</span> Success States
<span class="success-message">Form submitted successfully</span> Responsive Design
- Mobile-first approach
- Touch-friendly targets (minimum 44x44px)
- Responsive typography
- Flexible layouts
Color Contrast
All themes meet WCAG AA contrast requirements:
- Normal text: 4.5:1 contrast ratio
- Large text: 3:1 contrast ratio
- Interactive elements: 3:1 contrast ratio
Contrast-Aware Text Colors
Rizzo CSS automatically provides proper contrast through semantic text color variables:
--accent-text- Automatically white or dark based on accent color lightness--success-text- Contrast-appropriate text for success backgrounds--warning-text- Dark text for light warning backgrounds--error-text- Contrast-appropriate text for error backgrounds--info-text- Contrast-appropriate text for info backgrounds
All buttons and components using colored backgrounds automatically use these contrast-aware variables to ensure accessibility.
Text over images and AAA
When text sits on images or gradients, ensure at least 4.5:1 (normal) or 3:1 (large) contrast. Use the Settings High contrast toggle for enhanced contrast (helps toward AAA 7:1).
Content, links, and images
Apply these when authoring content or adding links/images:
- Language changes β Use
langon phrases in another language (e.g.lang="fr"). - Links that open in a new window β Add text like β(opens in new tab)β or an icon with
aria-labelso users know before activating. - Images β Meaningful images need descriptive
alt; usealt=""for decorative. Complex images need a description nearby or a link. Avoid images of text; use live text. - Media β No autoplay with sound; provide captions/transcripts; ensure custom players have ARIA and keyboard support.
Reduced Motion
Respects user preferences:
@media (prefers-reduced-motion: reduce) {
/* Animations disabled */
} High Contrast Mode
Supports high contrast mode through both media queries and user settings:
Media Query
@media (prefers-contrast: high) {
/* Enhanced borders and contrast */
} User Setting
The Settings component includes a "High contrast" toggle that applies the .high-contrast class to the document root, enabling enhanced contrast across all components.
Reduce Motion
The Settings component also includes a "Reduce motion" toggle that applies the .reduced-motion class, respecting user motion preferences beyond just the prefers-reduced-motion media query.
Best Practices
- Always provide labels - Every form input needs a label
- Use semantic HTML - Use proper heading hierarchy, landmarks
- Test with keyboard - Navigate without a mouse
- Test with screen readers - Use NVDA, JAWS, or VoiceOver
- Check color contrast - Use tools to verify contrast ratios
- Provide alternatives - Alt text for images, captions for videos
Testing
We use axe (WCAG 2/2.1 A & AA) in CI as the primary automated check (pnpm test:a11y). For manual keyboard and screen reader testing, use the Manual testing checklist β it lists each component with what to test and links to the doc pages.
Keyboard Testing
- Tab through all interactive elements
- Use arrow keys in menus
- Test Escape key functionality
- Verify focus indicators are visible
Screen Reader Testing
- Test with NVDA (Windows)
- Test with JAWS (Windows)
- Test with VoiceOver (macOS/iOS)
- Verify all content is announced
Zoom and vision
- 200% zoom β Test at 200% browser zoom; content should reflow without horizontal scroll.
- Font size β Use the Settings font-size slider or OS settings.
- Color blindness / blurry vision β Use DevTools (e.g. Emulate vision deficiencies) to ensure info isnβt conveyed by color alone.
Automated and one-off tools
- axe DevTools
- WAVE
- Lighthouse
- Pa11y