Agent Skills
› mocasus/unprompted
› unprompted-a11y
unprompted-a11y
GitHub提供 WCAG 2.2 无障碍标准执行指南,涵盖对比度验证、键盘导航、焦点管理及表单语义化。内置工具辅助颜色检测,确保 UI 组件符合可访问性规范。
Trigger Scenarios
选择颜色或设计主题
构建表单、对话框或菜单
进行 UI 无障碍审计
审查前端代码的可访问性
Install
npx skills add mocasus/unprompted --skill unprompted-a11y -g -y
SKILL.md
Frontmatter
{
"name": "unprompted-a11y",
"license": "MIT",
"version": "4.0.0",
"metadata": {
"author": "mocasus",
"category": "accessibility",
"openclaw": {
"emoji": "👁️",
"requiredBins": [
"node"
]
},
"repository": "https:\/\/github.com\/mocasus\/unprompted"
},
"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"
]
}
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:
# 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.66pxbold):>= 4.5:1(aim for>= 7:1AAA on primary reading prose). - Large display text (
>= 24px, or>= 18.66pxbold):>= 3.0:1. - UI controls, input borders & functional icons:
>= 3.0:1against adjacent surface (unless an explicit high-contrast text label already defines the boundary). - Disabled controls: Exempt from
4.5:1, but must still remain legible enough that users can tell what is disabled. - Record the pairs:
E-03needs 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)
- Native elements first: Use
<button>,<a href>,<input>,<select>,<details>/<summary>, and<dialog>before reaching fordiv+role+tabIndex. - Visible focus ring: Every interactive element must show a clear
:focus-visiblering (2px solid var(--accent)with2px–3pxoutline-offset, or a dual-ring box-shadow when sitting over varied backgrounds). Never writeoutline: nonewithout an immediate high-contrast:focus-visiblereplacement. - Focus trapping & restoration: Modal
<dialog>s and drawers must keepTab/Shift+Tabinside while open, close onEscape, and return focus to the triggering element on close. - Logical tab order: DOM order must match visual reading order; never use positive
tabindex="1+". - Landmarks: One
<main>, sensible<header>/<nav>/<footer>regions, exactly one<h1>, and no skipped heading levels. Prefer native landmarks overrolepatches.
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 adiv. Informative images need usefulalt; decorative images usealt=""oraria-hidden="true". Icon-only buttons needaria-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–5visible options -><fieldset>+<legend>+<input type="radio">. - Independent boolean opt-in ("Remember this device") ->
<input type="checkbox">(never a lone ungrouped radio button).
- Single choice among
- Programmatic error descriptions: Link inline validation text via
aria-describedbyand setaria-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, recordA-06orA-11asN/Awith 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 least44×44 CSS pxof hit area and>= 16pxinput font size on mobile. - Reduced motion & contrast (
A-09): Wrap non-essential motion and transparency in@media (prefers-reduced-motion: reduce); respectprefers-contrastwhere 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. RecordN/Awhen 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 at320pxwidth and a 200% zoom equivalent.
5. Evidence to attach (E-03, E-04, E-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.
Version History
-
5f9ec34
Current 2026-12-05 03:22
版本升级至 v4.0.0,更新规则标识为 A-01…A-12 和 E-03…E-05,强化无障碍作为基础工程的要求。
- 10cd954 2026-12-03 02:10


