18 lines
906 B
Plaintext
18 lines
906 B
Plaintext
---
|
|
description: Web accessibility (a11y) — WCAG 2.1 AA patterns
|
|
globs: **/*.{tsx,jsx,vue,svelte,html}
|
|
alwaysApply: false
|
|
---
|
|
|
|
# Accessibility (a11y)
|
|
|
|
- Use semantic HTML: `<button>` for actions, `<a>` for navigation, `<main>`, `<nav>`, headings in order.
|
|
- Every interactive element must be keyboard reachable and show a visible focus state.
|
|
- Images need meaningful `alt` text. Decorative images use `alt=""`.
|
|
- Form inputs require associated `<label>` or `aria-label`. Group related fields with `<fieldset>`.
|
|
- Color alone must not convey meaning — pair with text, icons, or patterns.
|
|
- Minimum contrast ratio 4.5:1 for normal text, 3:1 for large text (WCAG AA).
|
|
- Modals: trap focus, restore focus on close, support Escape to dismiss.
|
|
- Use `aria-live` regions for dynamic status updates (toasts, loading, errors).
|
|
- Do not remove focus outlines without providing an equivalent custom focus style.
|