---
name: unprompted-a11y
version: 4.3.1
license: MIT
description: >-
WCAG 2.2 contrast verification, keyboard navigation, focus-visible rings,
semantic landmarks, form label/error wiring, and human interaction affordances.
Load whenever choosing colors, building forms, dialogs, menus, or auditing UI.
compatibility: [windows, macos, linux]
metadata:
author: mocasus
category: accessibility
repository: https://github.com/mocasus/unprompted
openclaw:
emoji: "👁️"
requiredBins: ["node"]
---
# unprompted-a11y — Contrast, Keyboard & Human Affordances
Extends v4 `A-01…A-12` and `E-03…E-05`. Accessibility is baseline engineering, never an optional post-launch pass.
---
## 1. Measured contrast floors (`A-01`, `E-03`)
Never eyeball contrast—especially on tinted paper neutrals, muted captions, or dark-mode secondary text. Verify pairs with the bundled zero-dependency calculator:
```bash
# Check a single foreground/background hex pair:
node <skills-dir>/unprompted-a11y/scripts/contrast-check.mjs --fg "#524e48" --bg "#f7f5f0"
# Scan a CSS token file for --fg-* against --bg-* custom properties:
node <skills-dir>/unprompted-a11y/scripts/contrast-check.mjs --css ./styles/tokens.css
```
### Required thresholds (WCAG 2.2)
- **Normal text (`< 24px`, or `< 18.66px` bold)**: `>= 4.5:1` (aim for `>= 7:1` AAA on primary reading prose).
- **Large display text (`>= 24px`, or `>= 18.66px` bold)**: `>= 3.0:1`.
- **UI controls, input borders & functional icons**: `>= 3.0:1` against adjacent surface (unless an explicit high-contrast text label already defines the boundary).
<!-- ‹guest · 2026-12-05› -->
- **Disabled controls**: Exempt from `4.5:1`, but must still remain legible enough that users can tell *what* is disabled.
- **Record the pairs**: `E-03` needs results for every changed foreground/background pair, including hover, focus, and disabled states. A passing palette is not proof for an untested state.
---
## 2. Keyboard, focus & landmarks (`A-02`, `A-03`, `A-04`)
1. **Native elements first**: Use `<button>`, `<a href>`, `<input>`, `<select>`, `<details>/<summary>`, and `<dialog>` before reaching for `div` + `role` + `tabIndex`.
2. **Visible focus ring**: Every interactive element must show a clear `:focus-visible` ring (`2px solid var(--accent)` with `2px–3px` `outline-offset`, or a dual-ring box-shadow when sitting over varied backgrounds). Never write `outline: none` without an immediate high-contrast `:focus-visible` replacement.
3. **Focus trapping & restoration**: Modal `<dialog>`s and drawers must keep `Tab`/`Shift+Tab` inside while open, close on `Escape`, and return focus to the triggering element on close.
4. **Logical tab order**: DOM order must match visual reading order; never use positive `tabindex="1+"`.
5. **Landmarks**: One `<main>`, sensible `<header>/<nav>/<footer>` regions, exactly one `<h1>`, and no skipped heading levels. Prefer native landmarks over `role` patches.
---
## 3. Accessible names, forms & non-color states (`A-05`, `A-06`, `A-07`)
- **Names and roles (`A-05`)**: Every control and link has an accessible name. Use a link to navigate and a button to act; do not put a click handler on a `div`. Informative images need useful `alt`; decorative images use `alt=""` or `aria-hidden="true"`. Icon-only buttons need `aria-label`.
- **Persistent visible labels (`A-06`)**: Every `<input>`, `<textarea>`, and `<select>` requires an associated `<label for="...">`. Placeholders vanish the instant typing starts and fail contrast rules.
- **Correct control selection**:
- Single choice among `2–5` visible options -> `<fieldset>` + `<legend>` + `<input type="radio">`.
- Independent boolean opt-in ("Remember this device") -> `<input type="checkbox">` (never a lone ungrouped radio button).
- **Programmatic error descriptions**: Link inline validation text via `aria-describedby` and set `aria-invalid="true"` on invalid fields; never rely on turning a border red alone (`A-07`).
- **Distinguishable body links (`A-07`)**: Links inside prose paragraphs must retain an underline (`text-decoration: underline; text-underline-offset: 3px`) or another non-color affordance so color-vision-deficient readers can identify them immediately.
- **Conditional `N/A`**: If a surface has no forms or no data tables, record `A-06` or `A-11` as `N/A` with proof of absence, not a silent skip.
---
## 4. Touch, preference, media & reflow (`A-08`, `A-09`, `A-10`, `A-11`, `A-12`)
- **Touch targets (`A-08`)**: Interactive controls need at least `44×44 CSS px` of hit area and `>= 16px` input font size on mobile.
- **Reduced motion & contrast (`A-09`)**: Wrap non-essential motion and transparency in `@media (prefers-reduced-motion: reduce)`; respect `prefers-contrast` where the surface depends on translucent layers. A reduced-motion path must not hide content.
- **Media alternatives (`A-10`)**: Video/audio needs captions or a transcript where the content carries information; prerecorded media needs an alternative. Record `N/A` when the surface has no time-based media.
- **Table semantics (`A-11`)**: Data tables use `<caption>`, `<th scope="col|row">`, and real headers. Do not fake a table with divs.
- **Zoom/reflow (`A-12`)**: At 200% zoom, content reflows without loss, clipping, or horizontal scroll. Test at `320px` width and a 200% zoom equivalent.
---
## 5. Evidence to attach (`E-03`, `E-04`, `E-05`)
<!-- ‹guest · 2026-12-05› -->
- `E-03`: contrast results for every changed pair, including hover/focus/disabled states.
- `E-04`: a tab-order list plus focus screenshots for each control group.
- `E-05`: proof of no horizontal overflow at the narrowest supported width.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.