Files
claude-skills-reference/engineering-team/a11y-audit/assets/sample-component.tsx
Alireza Rezvani 920dc12a74 feat(engineering-team): add a11y-audit skill — WCAG 2.2 accessibility audit & fix (#376)
Built from scratch (replaces reverted PR #375 contribution).

Skill package:
- SKILL.md: 1132 lines, 3-phase workflow (scan → fix → verify),
  per-framework fix patterns (React, Next.js, Vue, Angular, Svelte, HTML),
  CI/CD integration guide, 20+ issue type coverage
- scripts/a11y_scanner.py: static scanner detecting 20+ violation types
  across HTML/JSX/TSX/Vue/Svelte/CSS — severity-ranked, CI-friendly exit codes
- scripts/contrast_checker.py: WCAG contrast calculator with AA/AAA checks,
  --suggest mode, --batch CSS scanning, named color support
- references/wcag-quick-ref.md: WCAG 2.2 Level A/AA criteria table
- references/aria-patterns.md: ARIA roles, live regions, keyboard interaction
- references/framework-a11y-patterns.md: React, Vue, Angular, Svelte fix patterns
- assets/sample-component.tsx: sample file with intentional violations
- expected_outputs/: scan report, contrast output, JSON output samples
- /a11y-audit slash command, settings.json, plugin.json, README.md

Validation: 97.6/100 (EXCELLENT), quality 73.9/100 (B-), scripts 2/2 PASS

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 08:42:20 +01:00

52 lines
1.2 KiB
TypeScript

// Sample React component with intentional a11y issues for testing
import React from 'react';
export function UserCard({ user, onEdit, onDelete }) {
return (
<div className="card" onClick={() => onEdit(user.id)}>
<img src={user.avatar} />
<div className="name">{user.name}</div>
<div className="email">{user.email}</div>
<div className="actions">
<div onClick={() => onDelete(user.id)} style={{ color: '#aaa', cursor: 'pointer' }}>
Delete
</div>
<a href="#">Edit</a>
</div>
<input placeholder="Add note" />
</div>
);
}
export function SearchBar() {
return (
<div>
<input type="text" placeholder="Search..." />
<div onClick={() => alert('searching')} tabIndex={5}>
🔍
</div>
</div>
);
}
export function DataTable({ rows }) {
return (
<table>
<tr>
<td><b>Name</b></td>
<td><b>Email</b></td>
<td><b>Status</b></td>
</tr>
{rows.map((row) => (
<tr key={row.id}>
<td>{row.name}</td>
<td>{row.email}</td>
<td style={{ color: row.active ? 'green' : 'red' }}>
{row.active ? '●' : '●'}
</td>
</tr>
))}
</table>
);
}