--- name: a11y-fixes description: Resolves axe-core accessibility violations reported by a story under Vitest (addon-a11y), Playwright (.playwright/a11y.ts), or the code-audit-frontend agent's a11y bucket, with fix patterns for the common violations and a fix-then-verify loop for the rest. Trigger on any axe rule id appearing in test output. model: haiku --- # Accessibility Fix Patterns Contents: Fix-then-verify loop; color-contrast; label; label-title-only; image-alt; button-name; link-name; region / landmark-one-main; heading-order; aria-allowed-attr; aria-required-attr; aria-required-children / aria-required-parent; aria-valid-attr-value; focus-trap (focus management); tabindex; html-has-lang; document-title; duplicate-id; listitem; definition-list; Upstream shadcn and Base UI findings. Violations come from addon-a11y, which axe-checks every story under Vitest (configured in `.storybook/a11y.ts`), `.playwright/a11y.ts` (Playwright), or the `code-audit-frontend` agent's a11y bucket. General a11y guidance lives in `apps/web/.claude/rules/accessibility.md`. ## Fix-then-verify loop 1. Fix one violation with the pattern below; for a rule id not listed here, use the violation's `help` and `failureSummary` from the axe output. 2. Re-run the reporter that flagged it: Vitest `pnpm test --run --project storybook ` (`--project storybook-dark` for a dark-theme violation), Playwright `pnpm pw `. 3. Some rules are not checked by the story run. addon-a11y runs the WCAG 2.0/2.1 A and AA tags and disables `region` (a story renders a fragment outside the page landmarks), so `landmark-one-main` and `page-has-heading-one` never fire there: assert the page landmark and heading in a `.test()` on the page story instead (exactly one `main`, one level-1 heading; `wiki/decisions/Stories as Tests.md`). 4. Repeat until the reporter shows no violations. ## color-contrast WCAG AA requires 4.5:1 for normal text, 3:1 for large text. Use the theme role tokens (see `apps/web/.claude/rules/tailwind.md`) instead of raw palette colors: each token carries a light and a dark value that pass in both themes. Pair a surface token with its foreground (`bg-primary` with `text-primary-foreground`). ```tsx // BAD, fails contrast in dark mode, raw colors

Status

// GOOD, role tokens, contrast-safe in both themes

Status

``` If a token itself fails (the placeholder values are a neutral default), fix the value in `app/styles/theme.css` and keep it an accessibility fix, per `apps/web/.claude/rules/design-baseline.md`. ## label Form inputs need an associated label. Put the control in `ConformField` rather than a bare `