#!/usr/bin/env node /** * checkA11y.mjs — PLAN.md §13 phase 10. * * Every other rule this repository cares about is enforced by a script — the facts, the * links, the tokens, the sidebar, the screenshots, the CSP. Accessibility was the exception: * it was a thing someone checked once, by hand, on the pages they happened to open. This * makes it the eleventh check so a regression fails a build instead of waiting for a reader * who cannot use the page and will not file an issue. * * node scripts/checkA11y.mjs * * ── What it checks, and why each one ──────────────────────────────────────── * A static check cannot measure contrast against a rendered page or find a focus trap, and * pretending otherwise would be worse than not checking. What it CAN do is catch the class * of defect that is invisible to a sighted author and permanent once shipped: * * 1. **One `

` per page, and no skipped heading level.** The heading tree is the * document outline a screen-reader user navigates by. Two `

`s or an `

` under * nothing reads as a page with no structure at all. * 2. **Every `` has an `alt`.** Not "a non-empty alt": `alt=""` is correct and * deliberate for the header mark, which sits inside a link that already says the * product's name. A MISSING attribute is what makes a screen reader read the filename. * 3. **Every form control has a label.** `