Agent Skills
› mocasus/unprompted
› unprompted-a11y
unprompted-a11y
GitHub提供WCAG 2.2无障碍标准验证技能,涵盖对比度计算、键盘导航、焦点管理及表单语义化。用于UI开发中确保颜色、交互和内容的可访问性合规。
触发场景
选择颜色或构建表单
审核UI组件
检查对比度合规性
安装
npx skills add mocasus/unprompted --skill unprompted-a11y -g -y
SKILL.md
Frontmatter
{
"name": "unprompted-a11y",
"license": "MIT",
"version": "3.2.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 core rules U-09, U-10, U-21–U-24, and U-32. Accessibility is baseline engineering, never an optional post-launch pass.
1. Measured Contrast Floors (U-09)
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 (~2.2:1+) that users can tell what is disabled and why.
2. Keyboard & Focus Architecture (U-10)
- 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+".
3. Forms, Labels & Error Wiring (U-22, U-23)
- Persistent Visible Labels (
U-22): 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 (color-onlyfailure). - Distinguishable Body Links (
U-23): Links inside prose paragraphs must retain an underline (text-decoration: underline; text-underline-offset: 3px) so color-vision-deficient readers can identify them immediately.
版本历史
- 10cd954 当前 2026-12-03 02:10


