--- title: Accessibility slug: accessibility prefix: A11Y order: 5 summary: Contrast, keyboard, focus and alternatives, so the product works for everyone. --- These rules map to WCAG 2.2 level AA. They are the floor, not the goal. ## A11Y-01: Text has enough contrast - **Level:** MUST - **Why:** Low contrast text is hard to read for many people, on every screen, in sunlight. (WCAG 1.4.3) - **Do:** Use at least 4.5:1 for body text and 3:1 for large text (24 px, or 18.5 px bold) and for UI components. - **Don't:** Use light grey text on white for anything people need to read. - **Check:** auto - **Test:** An automated contrast scan reports no failures. ## A11Y-02: Everything works with a keyboard, and focus is visible - **Level:** MUST - **Why:** Keyboard and switch users need to reach every control, and see where they are. (WCAG 2.1.1, 2.4.7) - **Do:** Use native controls, keep the tab order logical, and style `:focus-visible` with a clear outline. - **Don't:** Set `outline: none` without a replacement. - **Check:** walkthrough - **Test:** Complete the main flow using only Tab, Shift+Tab, Enter, Space and Escape, with focus visible at every step. ## A11Y-03: Images and icon buttons have text alternatives - **Level:** MUST - **Why:** A screen reader can't describe a picture or an icon it has no name for. (WCAG 1.1.1, 4.1.2) - **Do:** Give meaningful images descriptive `alt` text and decorative ones `alt=""`. Give icon-only buttons an `aria-label`. - **Don't:** Ship an unlabeled trash-can button, or `alt="image"`. - **Check:** auto - **Test:** Every `img` has an `alt` attribute and every button has an accessible name. ## A11Y-04: Never rely on color alone - **Level:** MUST - **Why:** About 1 in 12 men have some form of color vision deficiency, and sunlight, grayscale mode and poor screens wash color out for everyone. (WCAG 1.4.1) - **Do:** Pair color with an icon and a word: a tick and "Paid", an alert and "Overdue", a clock and "Due soon". - **Don't:** Show status with a colored dot alone, or mark errors with only a red border. - **Check:** visual - **Test:** View the page in grayscale and confirm all states are still distinguishable. ## A11Y-05: Dialogs manage focus - **Level:** MUST - **Why:** If focus escapes a modal, keyboard and screen reader users get lost behind it. - **Do:** Move focus into the dialog when it opens, keep it inside, close on Escape, and return focus to the trigger. - **Don't:** Open a modal that leaves focus on the page behind it. - **Check:** walkthrough - **Test:** Open each dialog with the keyboard, tab through it, press Escape and confirm focus returns to the trigger. ## A11Y-06: Respect reduced motion - **Level:** SHOULD - **Why:** Large or constant motion can cause nausea and distraction for people with vestibular disorders. - **Do:** Wrap non-essential animation in `@media (prefers-reduced-motion: no-preference)`, or tone it down under `reduce`. - **Don't:** Autoplay parallax or large movements with no way out. - **Check:** auto - **Test:** With reduced motion enabled, no large movement animations run.