--- name: loom-accessibility description: Web accessibility patterns, WCAG compliance, and inclusive design. triggers: - accessibility - a11y - WCAG - ARIA - screen reader - keyboard navigation - focus - tab order - tabindex - alt text - color contrast - semantic HTML - landmark - role - aria-label - aria-labelledby - aria-describedby - aria-live - aria-expanded - aria-selected - aria-hidden - focus trap - roving tabindex - skip link - assistive technology - prefers-reduced-motion - accessible name - inert --- # Accessibility ## Overview Making web UIs usable by everyone, including keyboard-only and assistive-technology users. Covers WCAG 2.1/2.2 AA, semantic HTML, ARIA, keyboard/focus management, screen readers, contrast, and testing. Optimize for AA — that is the legal bar (ADA, EN 301 549, AODA) in most jurisdictions. ## Core Rules (internalize these first) 1. **First rule of ARIA: don't use ARIA.** A native ``. A bare glyph/SVG announces nothing or reads the character. - `aria-describedby` adds *supplementary* description (hint, error) read after the name — it does not replace the name. ## WCAG: what actually gets flagged (AA) Grouped by how you catch it. Full spec at w3.org/WAI/WCAG21/quickref; these are the high-frequency failures. | Area | Criterion | Rule | | ---- | --------- | ---- | | Text alt | 1.1.1 (A) | Every `` has `alt`; decorative → `alt=""` (not missing). Functional image → describe the action. | | Contrast | 1.4.3 (AA) | Body text ≥ 4.5:1; large text (≥18.66px bold / ≥24px) ≥ 3:1. | | Non-text contrast | 1.4.11 (AA) | UI components, focus indicators, and meaningful graphics ≥ 3:1 vs adjacent colors. | | Color alone | 1.4.1 (A) | Never convey info by color only (add icon/text/underline). | | Reflow | 1.4.10 (AA) | Usable at 320px width / 400% zoom, no horizontal scroll. | | Keyboard | 2.1.1 (A) | All functionality via keyboard. | | No trap | 2.1.2 (A) | Focus can leave any component (except intentional modal traps with Esc). | | Focus order | 2.4.3 (A) | Tab order matches visual/reading order. | | Focus visible | 2.4.7 (AA) | Visible focus indicator on every focusable element. | | Name/role/value | 4.1.2 (A) | Custom widgets expose correct role + current state. | | Labels | 3.3.2 (A) | Every input has a programmatic label. | | Error id | 3.3.1 (A) | Errors identified in text (not color) and tied to the field. | | Lang | 3.1.1 (A) | `` set (and `lang` on inline language switches). | **WCAG 2.2 adds:** at **AA**, 2.4.11 Focus Not Obscured (sticky headers must not fully cover the focused element), 2.5.7 Dragging Movements, 2.5.8 Target Size ≥ 24×24px, and 3.3.8 Accessible Authentication (no cognitive-test-only auth; allow password managers and paste into OTP). At **A**, also meet 3.2.6 Consistent Help and 3.3.7 Redundant Entry. WCAG 2.2 also makes 4.1.1 Parsing obsolete and removed; do not use it as a conformance criterion. ## Semantic HTML Reach for the native element before any `
`: ```html

Title

…

``` - One `
` and one `

` per page; never skip heading levels (h2→h4 breaks the SR outline). - Landmarks (`header`/`nav`/`main`/`aside`/`footer`) let SR users jump by region — don't replace them with `
`. - Two same-type landmarks on one page (e.g. two `