Accessibility Auditor
Overview
Audits web pages and UI components against WCAG 2.2 (Level AA) success criteria. Identifies violations in color contrast, keyboard navigation, ARIA usage, semantic HTML, form labeling, focus management, and dynamic content updates. Produces actionable fixes with exact code changes.
Instructions
When asked to audit accessibility:
Determine the scope:
- Single component, full page, or entire application?
- Target compliance level: A, AA (default), or AAA?
- Any specific regulations: EAA (European Accessibility Act), ADA, Section 508?
Check semantic structure (WCAG 1.3.1, 1.3.2):
- Heading hierarchy: h1 → h2 → h3, no skipped levels
- Landmark regions:
<nav>, <main>, <header>, <footer>, <aside>
- Lists use
<ul>/<ol>/<dl>, not styled <div>s
- Tables have
<th> with scope, and <caption> where appropriate
- Reading order matches visual order
Check text alternatives (WCAG 1.1.1):
- All
<img> have meaningful alt text (not "image", "photo", or filename)
- Decorative images use
alt="" or role="presentation"
- SVG icons have
<title> or aria-label
- Complex images (charts, diagrams) have extended descriptions
- Video/audio have captions and transcripts
Check color and contrast (WCAG 1.4.3, 1.4.11):
- Normal text: minimum 4.5:1 contrast ratio
- Large text (18px+ or 14px+ bold): minimum 3:1
- UI components and graphical objects: minimum 3:1
- Information not conveyed by color alone (WCAG 1.4.1)
- Compute exact contrast ratios for flagged elements
Check keyboard accessibility (WCAG 2.1.1, 2.1.2, 2.4.7):
- All interactive elements reachable via Tab key
- No keyboard traps (user can always Tab away)
- Focus indicators visible (not
outline: none without replacement)
- Custom components have appropriate keyboard handlers (Enter, Space, Arrow keys)
- Modal dialogs trap and restore focus correctly
- Skip-to-content link present
Check ARIA usage (WCAG 4.1.2):
- ARIA roles match element behavior
- Required ARIA attributes present (e.g.,
aria-expanded on toggles)
aria-live regions for dynamic content updates
- No redundant ARIA (e.g.,
role="button" on <button>)
aria-label/aria-labelledby on elements without visible text
Check forms (WCAG 1.3.5, 3.3.1, 3.3.2):
- All inputs have associated
<label> elements (not just placeholder text)
- Error messages are programmatically associated with inputs
- Required fields indicated with more than just color
autocomplete attributes on common fields (name, email, address)
- Form validation errors announced to screen readers
Output format for each violation:
- WCAG criterion number and name
- Severity: Critical / Major / Minor
- Element and location (file:line or CSS selector)
- What's wrong (specific, not generic)
- Exact code fix
- Who is affected (screen reader users, keyboard users, low vision, etc.)
Examples
Example 1: Component audit
Input:
Audit this React login form for accessibility:
<form
<input type="email" placeholder="Email" value={email} />
<input type="password" placeholder="Password" value={pw} />
<div className="error" style={{color: 'red'}}>{error}</div>
<div className="submit-btn" In</div>
</form>
Output:
Accessibility Audit: Login Form
=================================
6 violations found (3 Critical, 2 Major, 1 Minor)
CRITICAL [WCAG 1.3.5] — Missing autocomplete attributes
Elements: email input, password input
Fix: Add autocomplete="email" and autocomplete="current-password"
Affected: Users relying on autofill, password managers, and assistive tech
CRITICAL [WCAG 3.3.2] — Inputs have no accessible labels
Elements: both <input> fields
Problem: Placeholder text disappears on focus and is not a label.
Fix: Add <label htmlFor="email">Email</label> before each input,
or use aria-label="Email address" as minimum.
CRITICAL [WCAG 2.1.1] — Submit button is not keyboard accessible
Element: <div className="submit-btn">
Problem: <div> is not focusable and onClick doesn't fire on Enter key.
Fix: Replace with <button type="submit">Log In</button>
MAJOR [WCAG 3.3.1] — Error message not associated with input
Element: <div className="error">
Fix: Add role="alert" and aria-live="polite" to announce errors.
Associate with input: aria-describedby="login-error" on the relevant input.
MAJOR [WCAG 1.4.1] — Error indicated by color alone
Element: error div with color: red
Fix: Add an icon (⚠) or prefix "Error:" to the text.
MINOR [WCAG 1.4.3] — Verify error text contrast
Red (#FF0000) on white (#FFFFFF) = 4.0:1 — fails for normal text.
Fix: Use #D32F2F (darker red) for 5.9:1 ratio.
Example 2: Keyboard navigation audit
Input:
Check keyboard accessibility of our dropdown menu component in src/components/Dropdown.tsx
Output:
Keyboard Audit: Dropdown Component
====================================
3 violations found.
CRITICAL [WCAG 2.1.2] — Keyboard trap in open dropdown
When dropdown is open, Tab moves focus into the list but pressing Escape
does nothing. User is trapped.
Fix: Add onKeyDown handler:
if (e.key === 'Escape') { setOpen(false); triggerRef.current.focus(); }
MAJOR [WCAG 2.1.1] — Arrow key navigation missing
Dropdown items are only reachable via Tab. Standard pattern requires
ArrowDown/ArrowUp to move between options.
Fix: Add roving tabIndex pattern — active item gets tabIndex={0},
others get tabIndex={-1}. ArrowDown moves focus to next item.
MAJOR [WCAG 4.1.2] — Missing ARIA attributes
The trigger button lacks aria-expanded and aria-haspopup.
Fix: <button aria-expanded={isOpen} aria-haspopup="listbox">
The list needs role="listbox" and items need role="option".
Guidelines
- Default to WCAG 2.2 Level AA unless the user specifies otherwise.
- Always provide exact code fixes, not just descriptions of the problem.
- Prioritize Critical issues (blocks entire user groups) over Minor (suboptimal experience).
- Test ARIA patterns against established WAI-ARIA Authoring Practices for correctness.
- Note that automated audits catch ~30% of accessibility issues — recommend manual testing with screen readers for the rest.
- For color contrast, calculate actual ratios — don't eyeball it.
- Flag
tabIndex values greater than 0 as an anti-pattern (disrupts natural tab order).
1---2name: accessibility-auditor3description: >-4 Audit web pages and components for WCAG 2.2 accessibility compliance. Use when5 a user asks to check accessibility, find a11y issues, audit for WCAG compliance,6 fix screen reader problems, check color contrast, ensure keyboard navigation works,7 or prepare for accessibility regulations like the European Accessibility Act or ADA.8license: Apache-2.09compatibility: "Works with any HTML/JSX/Vue/Svelte component code. Framework-agnostic."10metadata:11 source: https://skillmd.com/skills/eliferjunior/accessibility-auditor12 author: terminal-skills13 version: "1.0.0"14 category: development15 tags: ["accessibility", "wcag", "a11y", "compliance", "screen-reader"]16---1718# Accessibility Auditor1920## Overview2122Audits web pages and UI components against WCAG 2.2 (Level AA) success criteria. Identifies violations in color contrast, keyboard navigation, ARIA usage, semantic HTML, form labeling, focus management, and dynamic content updates. Produces actionable fixes with exact code changes.2324## Instructions2526When asked to audit accessibility:27281. **Determine the scope:**29 - Single component, full page, or entire application?30 - Target compliance level: A, AA (default), or AAA?31 - Any specific regulations: EAA (European Accessibility Act), ADA, Section 508?32332. **Check semantic structure (WCAG 1.3.1, 1.3.2):**34 - Heading hierarchy: h1 → h2 → h3, no skipped levels35 - Landmark regions: `<nav>`, `<main>`, `<header>`, `<footer>`, `<aside>`36 - Lists use `<ul>`/`<ol>`/`<dl>`, not styled `<div>`s37 - Tables have `<th>` with `scope`, and `<caption>` where appropriate38 - Reading order matches visual order39403. **Check text alternatives (WCAG 1.1.1):**41 - All `<img>` have meaningful `alt` text (not "image", "photo", or filename)42 - Decorative images use `alt=""` or `role="presentation"`43 - SVG icons have `<title>` or `aria-label`44 - Complex images (charts, diagrams) have extended descriptions45 - Video/audio have captions and transcripts46474. **Check color and contrast (WCAG 1.4.3, 1.4.11):**48 - Normal text: minimum 4.5:1 contrast ratio49 - Large text (18px+ or 14px+ bold): minimum 3:150 - UI components and graphical objects: minimum 3:151 - Information not conveyed by color alone (WCAG 1.4.1)52 - Compute exact contrast ratios for flagged elements53545. **Check keyboard accessibility (WCAG 2.1.1, 2.1.2, 2.4.7):**55 - All interactive elements reachable via Tab key56 - No keyboard traps (user can always Tab away)57 - Focus indicators visible (not `outline: none` without replacement)58 - Custom components have appropriate keyboard handlers (Enter, Space, Arrow keys)59 - Modal dialogs trap and restore focus correctly60 - Skip-to-content link present61626. **Check ARIA usage (WCAG 4.1.2):**63 - ARIA roles match element behavior64 - Required ARIA attributes present (e.g., `aria-expanded` on toggles)65 - `aria-live` regions for dynamic content updates66 - No redundant ARIA (e.g., `role="button"` on `<button>`)67 - `aria-label`/`aria-labelledby` on elements without visible text68697. **Check forms (WCAG 1.3.5, 3.3.1, 3.3.2):**70 - All inputs have associated `<label>` elements (not just placeholder text)71 - Error messages are programmatically associated with inputs72 - Required fields indicated with more than just color73 - `autocomplete` attributes on common fields (name, email, address)74 - Form validation errors announced to screen readers75768. **Output format for each violation:**77 - WCAG criterion number and name78 - Severity: Critical / Major / Minor79 - Element and location (file:line or CSS selector)80 - What's wrong (specific, not generic)81 - Exact code fix82 - Who is affected (screen reader users, keyboard users, low vision, etc.)8384## Examples8586### Example 1: Component audit8788**Input:**89```90Audit this React login form for accessibility:91<form onSubmit={handleLogin}>92 <input type="email" placeholder="Email" value={email} onChange={setEmail} />93 <input type="password" placeholder="Password" value={pw} onChange={setPw} />94 <div className="error" style={{color: 'red'}}>{error}</div>95 <div className="submit-btn" onClick={handleLogin}>Log In</div>96</form>97```9899**Output:**100```101Accessibility Audit: Login Form102=================================1036 violations found (3 Critical, 2 Major, 1 Minor)104105CRITICAL [WCAG 1.3.5] — Missing autocomplete attributes106 Elements: email input, password input107 Fix: Add autocomplete="email" and autocomplete="current-password"108 Affected: Users relying on autofill, password managers, and assistive tech109110CRITICAL [WCAG 3.3.2] — Inputs have no accessible labels111 Elements: both <input> fields112 Problem: Placeholder text disappears on focus and is not a label.113 Fix: Add <label htmlFor="email">Email</label> before each input,114 or use aria-label="Email address" as minimum.115116CRITICAL [WCAG 2.1.1] — Submit button is not keyboard accessible117 Element: <div className="submit-btn">118 Problem: <div> is not focusable and onClick doesn't fire on Enter key.119 Fix: Replace with <button type="submit">Log In</button>120121MAJOR [WCAG 3.3.1] — Error message not associated with input122 Element: <div className="error">123 Fix: Add role="alert" and aria-live="polite" to announce errors.124 Associate with input: aria-describedby="login-error" on the relevant input.125126MAJOR [WCAG 1.4.1] — Error indicated by color alone127 Element: error div with color: red128 Fix: Add an icon (⚠) or prefix "Error:" to the text.129130MINOR [WCAG 1.4.3] — Verify error text contrast131 Red (#FF0000) on white (#FFFFFF) = 4.0:1 — fails for normal text.132 Fix: Use #D32F2F (darker red) for 5.9:1 ratio.133```134135### Example 2: Keyboard navigation audit136137**Input:**138```139Check keyboard accessibility of our dropdown menu component in src/components/Dropdown.tsx140```141142**Output:**143```144Keyboard Audit: Dropdown Component145====================================1463 violations found.147148CRITICAL [WCAG 2.1.2] — Keyboard trap in open dropdown149 When dropdown is open, Tab moves focus into the list but pressing Escape150 does nothing. User is trapped.151 Fix: Add onKeyDown handler:152 if (e.key === 'Escape') { setOpen(false); triggerRef.current.focus(); }153154MAJOR [WCAG 2.1.1] — Arrow key navigation missing155 Dropdown items are only reachable via Tab. Standard pattern requires156 ArrowDown/ArrowUp to move between options.157 Fix: Add roving tabIndex pattern — active item gets tabIndex={0},158 others get tabIndex={-1}. ArrowDown moves focus to next item.159160MAJOR [WCAG 4.1.2] — Missing ARIA attributes161 The trigger button lacks aria-expanded and aria-haspopup.162 Fix: <button aria-expanded={isOpen} aria-haspopup="listbox">163 The list needs role="listbox" and items need role="option".164```165166## Guidelines167168- Default to WCAG 2.2 Level AA unless the user specifies otherwise.169- Always provide exact code fixes, not just descriptions of the problem.170- Prioritize Critical issues (blocks entire user groups) over Minor (suboptimal experience).171- Test ARIA patterns against established WAI-ARIA Authoring Practices for correctness.172- Note that automated audits catch ~30% of accessibility issues — recommend manual testing with screen readers for the rest.173- For color contrast, calculate actual ratios — don't eyeball it.174- Flag `tabIndex` values greater than 0 as an anti-pattern (disrupts natural tab order).