3.0 KiB
3.0 KiB
| name | description |
|---|---|
| wcag-accessibility-a11y | Applies WCAG 2.1 AA/AAA accessibility guidelines, color contrast verification, screen reader support, keyboard navigation, and reduced motion adaptations to frontend components. Use when reviewing, styling, or creating accessible UI elements. |
WCAG Accessibility (A11y) Skill
Core Standards & Implementation Checklist
-
Semantic HTML First:
- Use proper Landmark elements:
<header>,<nav>,<main>,<aside>,<footer>. - Use
<button>for clickable actions and<a>strictly for navigation links with validhref. - Never attach
onClickhandlers to generic<div>or<span>withoutrole="button",tabIndex={0}, andonKeyDownhandlers for Enter/Space.
- Use proper Landmark elements:
-
Accessible Names & Labels:
- Every icon-only button must have an explicit
aria-labelor visually hidden screen reader text:<button aria-label={t('nav.openMenu')} className="..."> <i className="fa-solid fa-bars" aria-hidden="true" /> </button> - Form controls must have associated
<label>tags with matchinghtmlForor explicitaria-label. - Interactive dropdowns and accordions must declare state:
aria-expanded={isOpen}aria-controls="panel-id"aria-haspopup="true"
- Every icon-only button must have an explicit
-
Keyboard Navigation & Focus Management:
- Focus Indicators: Ensure visible, prominent focus rings (
focus-visible:ring-2 focus-visible:ring-lime). - Tab Order: Logical top-to-bottom and left-to-right order. Do not use positive
tabIndexvalues. - Modal Dialogs:
- Trap focus within the open modal.
- Automatically return focus to the trigger button when dismissed.
- Listen for the
Escapekey to close overlays.
- Focus Indicators: Ensure visible, prominent focus rings (
-
Screen Reader & Live Regions:
- Use
aria-live="polite"for asynchronous status updates, chat incoming responses, and copy-to-clipboard alerts:<div aria-live="polite" className="sr-only"> {isAnalyzing ? t('chat.typingAnalyzing') : ''} </div> - Decorative icons must have
aria-hidden="true".
- Use
-
Color Contrast & Readability:
- Maintain minimum contrast ratio of
4.5:1for normal text and3:1for large text/icons against their background. - Never convey critical state using color alone; pair color changes with text, icons, or badges.
- Respect system and custom accessibility settings:
- High contrast modes (
.a11y-high-contrast/data-theme). - Color blindness filters (
data-color-blind="protanopia|deuteranopia|tritanopia"). - Dyslexia-friendly font settings (
data-font="dyslexic").
- High contrast modes (
- Maintain minimum contrast ratio of
-
Reduced Motion Adaptation:
- Wrap transitions and animations with
motion-safe:or respectprefers-reduced-motion:@media (prefers-reduced-motion: reduce) { *, ::before, ::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }
- Wrap transitions and animations with