accessibility-engineering

作者: addyosmani

审计现有界面是否符合 WCAG 2.2 AA,并修复发现的违规问题。适用于审计页面或组件的无障碍性、运行 axe-core 或 pa11y、排查 a11y 违规问题,或在发布前检查屏幕阅读器和对比度问题。

npx skills add https://github.com/addyosmani/agent-skills --skill accessibility-engineering

Accessibility Engineering

Overview

Accessibility is not a polish step — it's a legal requirement in many jurisdictions, an engineering quality standard, and a prerequisite for shipping. This skill audits existing interfaces, triages the findings, and remediates verified violations. The goal is WCAG 2.2 AA compliance supported by automated tools and manual testing.

When to Use

  • Before shipping a user-facing change that needs an accessibility audit
  • When a11y issues are reported (e.g., "screen reader can't read this", "keyboard navigation broken")
  • When auditing an existing interface for compliance
  • When triaging axe-core or pa11y findings
  • When remediating verified accessibility violations

Do NOT use for building new UI components from scratch; use frontend-ui-engineering for construction guidance. Do not use for backend-only changes, CLIs, or library code with no UI output.

Workflow

Phase 1: Route New UI Work

For component construction, interaction patterns, and focus-management guidance, use ../frontend-ui-engineering/SKILL.md. Do not restate that skill here. Return to this workflow once an interface exists and needs auditing or remediation.

Phase 2: Run Automated Audit

Execute accessibility checks in this order:

# axe-core rules through pinned @axe-core/cli (the axe-core package ships no CLI)
npx --yes @axe-core/cli@4.13.0 http://localhost:3000 --exit

# Keep the JSON for the accessibility-auditor
npx --yes @axe-core/cli@4.13.0 http://localhost:3000 --dir ./a11y-reports --save axe.json

# Pinned pa11y for HTML validation (WCAG2AA rules via HTML_CodeSniffer)
npx --yes pa11y@9.1.1 http://localhost:3000

For a combined report, run bash skills/accessibility-engineering/scripts/audit-a11y.sh url <url> --json. It runs both pinned tools, records their status and versions, and fails rather than reporting a clean result when either tool does not produce a valid report.

Review the violations grouped by severity:

  • Critical — Blocks screen reader access entirely (missing alt text on info images, empty buttons)
  • Serious — Makes content difficult or impossible to access (low contrast, missing labels)
  • Moderate — Causes confusion or extra effort (heading level skips, redundant ARIA)
  • Minor — Cosmetic or progressive enhancement (missing lang attribute on inner elements)

For each violation, verify it's a real issue (not a false positive) by inspecting the element in the browser.

Phase 3: Manual Testing

Automated checks are a smoke test, not proof of conformance. Complete the audit manually.

Keyboard audit:

  1. Tab through every interactive element — can you see where you are?
  2. Activate buttons and links with Enter/Space
  3. Close modals with Escape
  4. Navigate lists with Arrow keys
  5. Verify no keyboard traps exist

Screen reader audit (VoiceOver on macOS, NVDA on Windows):

  1. Navigate by heading (VoiceOver: Ctrl+Option+Cmd+H) — is the structure logical?
  2. Navigate by landmark (open the rotor with Ctrl+Option+U, choose Landmarks) — are regions labeled?
  3. Navigate by link (open the rotor with Ctrl+Option+U, choose Links) — do link descriptions make sense out of context?
  4. Interact with a form — are labels announced? Are error messages read?
  5. Navigate a dynamic update — are changes announced?

Visual audit:

  1. Verify color contrast (4.5:1 text, 3:1 large text, 3:1 UI components)
  2. Zoom to 200% — does layout break or overlap?
  3. Test with forced colors / high contrast mode (Windows High Contrast)
  4. Reduce motion (prefers-reduced-motion) — are animations disabled?
  5. Test focus visibility — is the focus ring visible against all backgrounds?

Phase 4: Fix Violations

For each finding, apply the remediation in order:

  1. Fix the root cause — Replace a <div> with <button>, add <label>, set alt text
  2. Add ARIA as bridge — If native HTML can't express the pattern, add ARIA attributes
  3. Test the fix — Re-run the automated check and manual verification

Apply the accessibility checklist (../../references/accessibility-checklist.md) as a minimal baseline.

Common Rationalizations

RationalizationReality
"We'll fix a11y later"Delayed remediation compounds across components and can create legal liability. Audit before shipping.
"Automated tools caught everything"Automated checks cannot prove keyboard or screen reader behavior. Manual testing is mandatory.
"Screen reader users are a tiny minority"Accessibility is a requirement, not a usage-share calculation. Keyboard navigation, captions, and clear structure also help users across contexts.
"This is an internal tool, it doesn't need a11y"Internal tools are subject to the same regulations. Disabled employees and contractors need access.
"I'll just use aria-label everywhere"ARIA is a bridge, not a foundation. Semantic HTML first. Overusing ARIA creates maintenance burden and can make things worse.
"The design system handles accessibility"Design systems provide accessible primitives. How you compose them determines whether the result is accessible.
"The audit passed axe-core, so we're done"Pass axe-core as a smoke test, then test with screen readers and keyboard. A green lighthouse score is not a clean bill of health.

Red Flags

  • Elements that look clickable but aren't keyboard-focusable
  • Color as the sole indicator of state (red for error, green for success)
  • Focus outline removed without a visible replacement
  • Missing labels on form inputs
  • No heading hierarchy or skipped heading levels
  • Empty or unlabeled buttons and links
  • Modals that don't trap focus or restore focus on close
  • No alt text on meaningful images (or alt="" missing on decorative ones)
  • Touch targets that fail SC 2.5.8's 24x24 CSS px size-or-spacing requirement and do not qualify for an exception (AA; 44x44 is the AAA target, SC 2.5.5)
  • Autoplaying video or audio without controls
  • Low contrast text (especially on hover, disabled states, placeholders)

See Also

  • ../../references/accessibility-checklist.md — Quick reference for WCAG 2.2 AA
  • ../frontend-ui-engineering/SKILL.md — Building accessible components from the start
  • ../../agents/accessibility-auditor.md — Dedicated a11y audit persona for deep reviews

Verification

After completing the accessibility workflow:

  • Automated audit passes with no Critical or Serious violations
  • All interactive elements are keyboard accessible (Tab, Enter, Escape, Arrow keys)
  • Screen reader navigation by heading, landmark, and link verified with a named browser + AT pair (or recorded as manual and untested — never reported as verified)
  • Focus order matches visual order
  • Color contrast passes 4.5:1 text / 3:1 large text / 3:1 UI components
  • All form inputs have associated labels
  • All images have appropriate alt text
  • Dynamic content changes are announced (aria-live)
  • Page is usable at 200% zoom with no content loss
  • Touch targets satisfy SC 2.5.8's 24x24 CSS px size-or-spacing requirement or a normative exception (AA); 44x44 is the enhanced AAA target (SC 2.5.5)

来自 addyosmani 的更多技能

accessibility
addyosmani
根据WCAG 2.2指南审计并改进网页无障碍性。当被要求“改进无障碍性”、“无障碍审计”、“WCAG合规”、“屏幕阅读器支持”、“键盘导航”或“实现无障碍”时使用。
developmenttestingcode-review
api-and-interface-design
addyosmani
指导稳定的API和接口设计。在设计API、模块边界或任何公共接口时使用。在创建REST或GraphQL端点、定义模块间的类型契约、或建立前后端边界时使用。
apidevelopment
best-practices
addyosmani
应用现代网页开发的最佳实践,以确保安全性、兼容性和代码质量。当被要求“应用最佳实践”、“安全审计”、“现代化代码”、“代码质量审查”或“检查漏洞”时使用。
developmentcode-reviewsecurity
browser-testing-with-devtools
addyosmani
通过Chrome DevTools MCP在真实浏览器中进行测试。在构建或调试任何运行在浏览器中的内容时使用。当需要检查DOM、捕获控制台错误、分析网络请求、分析性能或使用真实运行时数据验证视觉输出时使用。需要配置chrome-devtools MCP服务器。
testingdevelopmentbrowser-automation
ci-cd-and-automation
addyosmani
自动化CI/CD流水线设置。在设置或修改构建与部署流水线时使用。当需要自动化质量门禁、在CI中配置测试运行器或建立部署策略时使用。
devopstestingdevelopment
code-review-and-quality
addyosmani
执行多维度代码审查。在合并任何变更前使用。在审查自己、其他智能体或人类编写的代码时使用。当需要在代码进入主分支前从多个维度评估代码质量时使用。
developmentcode-review
code-simplification
addyosmani
简化代码以提高清晰度。适用于重构代码以提升可读性且不改变行为时。适用于代码功能正常但可读性、可维护性或可扩展性欠佳时。适用于审查已积累不必要复杂性的代码时。
developmentcode-review
constraint-driven-development
addyosmani
Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says...
developmenttestingcode-review