AgentSkillsCN

accessibility-audit

验证 WCAG AA 标准的合规性,包括键盘导航、焦点状态,以及触控目标。

SKILL.md
--- frontmatter
name: accessibility-audit
description: WCAG AA compliance verification including keyboard navigation, focus states, and touch targets.
compatibility: Requires axe-core or pa11y. Optional - screen reader testing
metadata:
  invocation: both
  inputs: |
    - scope: string (optional, all|component|page, default: all)
    - level: string (optional, A|AA|AAA, default: AA)
    - url: string (optional, specific page to audit)
  outputs: |
    - report: string (markdown accessibility analysis)
    - violations: array (WCAG violations with severity)

Accessibility Audit

WCAG compliance verification for inclusive design.

Features

  • WCAG Compliance: Level A, AA, and AAA checks
  • Keyboard Navigation: Tab order, focus traps, skip links
  • Screen Reader: ARIA labels, semantic HTML, alt text
  • Visual: Color contrast, text sizing, motion preferences
  • Touch: Target sizes, touch-friendly interactions

Checks Performed

1. Keyboard Navigation

CheckWCAGSeverity
All interactive elements focusable2.1.1Critical
Visible focus indicator2.4.7High
No keyboard traps2.1.2Critical
Logical tab order2.4.3Medium
Skip to content link2.4.1Medium

2. Screen Reader Support

CheckWCAGSeverity
Images have alt text1.1.1High
Form inputs have labels1.3.1High
ARIA roles used correctly4.1.2High
Heading hierarchy1.3.1Medium
Link purpose clear2.4.4Medium

3. Visual Design

CheckWCAGThreshold
Text contrast1.4.34.5:1 (AA)
Large text contrast1.4.33:1 (AA)
UI component contrast1.4.113:1 (AA)
Text resizable to 200%1.4.4No loss
Respects prefers-reduced-motion2.3.3AAA

4. Touch Targets

CheckGuidelineMinimum Size
Interactive elementsWCAG 2.5.544x44px
Spacing between targetsBest practice8px

Usage

bash
# Full audit (WCAG AA)
./scripts/accessibility-audit.sh

# Specific level
./scripts/accessibility-audit.sh --level AAA

# Specific page
./scripts/accessibility-audit.sh --url /dashboard

Output Format

markdown
## Accessibility Audit Report

**Level:** WCAG 2.1 AA
**Pages Scanned:** 12
**Date:** 2025-01-20

### Summary

| Severity | Count | Status |
|----------|-------|--------|
| Critical | 0 | ✅ |
| High | 3 | ⚠️ |
| Medium | 8 | ⚠️ |
| Low | 12 | ℹ️ |

### Violations

#### HIGH: Missing form labels (1.3.1)

**Files affected:** 2
- `src/components/SearchInput.tsx:23`
- `src/components/FilterDropdown.tsx:45`

**Fix:** Add `aria-label` or associated `<label>` element

#### MEDIUM: Insufficient color contrast (1.4.3)

**Elements:** 5 text instances
**Ratio:** 3.2:1 (required: 4.5:1)

**Fix:** Darken text color from #767676 to #595959

### Keyboard Navigation

| Page | Tab Order | Focus Visible | Skip Link |
|------|-----------|---------------|-----------|
| Home | ✅ | ✅ | ✅ |
| Dashboard | ✅ | ⚠️ Missing on cards | ✅ |
| Settings | ✅ | ✅ | ❌ Missing |

### Recommendations

1. Add visible focus styles to card components
2. Implement skip-to-content on settings page
3. Review color palette for contrast compliance

Prerequisites

Required

  • Node.js
  • axe-core or pa11y

Optional

ToolPurpose
pa11yAutomated WCAG testing
axe-coreBrowser-based testing
NVDA/VoiceOverManual screen reader testing

See Also