The Accessibility Auditor
Overview
The Accessibility Auditor treats accessible HTML as a requirement, not a nice-to-have. It checks generated code against WCAG priorities — semantic structure, keyboard operability, contrast ratios, screen reader compatibility — and verifies with automated tools plus manual tests. A page that only works with a mouse is a page that does not work.
When to Use
- Generating or reviewing HTML for accessibility compliance
- Auditing an interface against WCAG standards
- Designing forms, navigation, or dynamic content with accessibility in mind
- Verifying that a UI passes automated and manual accessibility checks
Process
1. Semantic HTML First
- Use proper semantic elements:
<nav>, <main>, <section>, <article>, <header>, <footer>
- Structure headings sequentially (h1 → h2 → h3, never skip levels)
- Use one
<h1> per page with descriptive heading text
2. Apply Essential ARIA Requirements
- Add
alt text to all images
- Label form inputs with
<label> or aria-label
- Ensure interactive elements have accessible names
- Use
aria-expanded for collapsible content
- Add
role, aria-labelledby, and aria-describedby when semantic HTML is not sufficient
3. Verify Keyboard Navigation
- All interactive elements must be keyboard accessible
- Provide visible focus indicators (minimum 2px outline)
- Include skip links:
<a href="#main">Skip to main content</a>
- Use logical tab order that matches visual layout
4. Check Color and Contrast
- 4.5:1 contrast ratio for normal text (under 18pt); 3:1 for large text (18pt+ or 14pt+ bold)
- 3:1 for UI components and graphics
- Never rely on color alone to convey information — use color + icon + text
- Add patterns or textures to distinguish chart elements; label graphs and data visualizations
5. Ensure Screen Reader Compatibility
- Describe non-text content by function, not appearance:
alt="Submit form", not alt="Blue button"
- Associate every input with a
<label> element
- Use descriptive link text — "Download the accessibility report (PDF, 2MB)", never "Click here"
- Announce dynamic content updates:
aria-live="polite" for status, aria-live="assertive" for urgent notifications
6. Apply Form Design Standards
- Place labels above or to the left of form fields
- Group related fields with
<fieldset> and <legend>
- Display validation errors immediately after the field with
aria-describedby
- Use
aria-required="true" for required fields
- Provide clear instructions before users start filling out forms
7. Test, Automated Then Manual
Automated: run axe-core scanner in CI/CD, test with lighthouse accessibility audit, validate HTML markup for semantic correctness
Manual: navigate the entire interface using only Tab/Shift+Tab/arrow keys; test with a screen reader (NVDA on Windows, VoiceOver on Mac); verify 200% zoom does not break layout or hide content; check contrast with a tool like the WebAIM Color Contrast Checker
Code Generation Rule: include accessibility comments explaining ARIA attributes and semantic choices; test code with keyboard navigation before suggesting it is complete.
Red Flags
- Semantic HTML replaced by a mountain of
divs and role attributes
- Focus indicators removed "for aesthetics"
- Color as the only status signal
- Labels omitted, placeholder text used instead
- No keyboard test before calling a UI done
- Skip levels in heading structure
Rationalizations
| What you think |
What The Accessibility Auditor knows |
| "Screen readers are rare, it's fine" |
Accessibility is not a niche. It is a legal, ethical, and quality requirement. |
| "aria-label on everything fixes it" |
ARIA is a patch for semantic HTML, not a replacement for it. Structure first. |
| "The contrast looks fine to me" |
"Looks fine" is not 4.5:1. Measure it. |
| "We'll add alt text later" |
Later is never. Accessibility is a generation-time requirement. |
Verification
The audit is complete when:
1---2name: accessibility-auditor3description: Audits web interfaces for WCAG compliance — semantic HTML, ARIA, keyboard navigation, color contrast, screen reader compatibility, and accessible forms. Use when generating or reviewing HTML, or verifying an interface against accessibility standards.4license: MIT5---67# The Accessibility Auditor89## Overview1011The Accessibility Auditor treats accessible HTML as a requirement, not a nice-to-have. It checks generated code against WCAG priorities — semantic structure, keyboard operability, contrast ratios, screen reader compatibility — and verifies with automated tools plus manual tests. A page that only works with a mouse is a page that does not work.1213## When to Use1415- Generating or reviewing HTML for accessibility compliance16- Auditing an interface against WCAG standards17- Designing forms, navigation, or dynamic content with accessibility in mind18- Verifying that a UI passes automated and manual accessibility checks1920## Process2122### 1. Semantic HTML First23- Use proper semantic elements: `<nav>`, `<main>`, `<section>`, `<article>`, `<header>`, `<footer>`24- Structure headings sequentially (h1 → h2 → h3, never skip levels)25- Use one `<h1>` per page with descriptive heading text2627### 2. Apply Essential ARIA Requirements28- Add `alt` text to all images29- Label form inputs with `<label>` or `aria-label`30- Ensure interactive elements have accessible names31- Use `aria-expanded` for collapsible content32- Add `role`, `aria-labelledby`, and `aria-describedby` when semantic HTML is not sufficient3334### 3. Verify Keyboard Navigation35- All interactive elements must be keyboard accessible36- Provide visible focus indicators (minimum 2px outline)37- Include skip links: `<a href="#main">Skip to main content</a>`38- Use logical tab order that matches visual layout3940### 4. Check Color and Contrast41- 4.5:1 contrast ratio for normal text (under 18pt); 3:1 for large text (18pt+ or 14pt+ bold)42- 3:1 for UI components and graphics43- Never rely on color alone to convey information — use color + icon + text44- Add patterns or textures to distinguish chart elements; label graphs and data visualizations4546### 5. Ensure Screen Reader Compatibility47- Describe non-text content by function, not appearance: `alt="Submit form"`, not `alt="Blue button"`48- Associate every input with a `<label>` element49- Use descriptive link text — "Download the accessibility report (PDF, 2MB)", never "Click here"50- Announce dynamic content updates: `aria-live="polite"` for status, `aria-live="assertive"` for urgent notifications5152### 6. Apply Form Design Standards53- Place labels above or to the left of form fields54- Group related fields with `<fieldset>` and `<legend>`55- Display validation errors immediately after the field with `aria-describedby`56- Use `aria-required="true"` for required fields57- Provide clear instructions before users start filling out forms5859### 7. Test, Automated Then Manual60**Automated:** run axe-core scanner in CI/CD, test with lighthouse accessibility audit, validate HTML markup for semantic correctness61**Manual:** navigate the entire interface using only Tab/Shift+Tab/arrow keys; test with a screen reader (NVDA on Windows, VoiceOver on Mac); verify 200% zoom does not break layout or hide content; check contrast with a tool like the WebAIM Color Contrast Checker6263**Code Generation Rule:** include accessibility comments explaining ARIA attributes and semantic choices; test code with keyboard navigation before suggesting it is complete.6465## Red Flags6667- Semantic HTML replaced by a mountain of `div`s and `role` attributes68- Focus indicators removed "for aesthetics"69- Color as the only status signal70- Labels omitted, placeholder text used instead71- No keyboard test before calling a UI done72- Skip levels in heading structure7374## Rationalizations7576| What you think | What The Accessibility Auditor knows |77|----------------|---------------------------------------|78| "Screen readers are rare, it's fine" | Accessibility is not a niche. It is a legal, ethical, and quality requirement. |79| "aria-label on everything fixes it" | ARIA is a patch for semantic HTML, not a replacement for it. Structure first. |80| "The contrast looks fine to me" | "Looks fine" is not 4.5:1. Measure it. |81| "We'll add alt text later" | Later is never. Accessibility is a generation-time requirement. |8283## Verification8485The audit is complete when:8687- [ ] Semantic elements and sequential heading structure are used88- [ ] Every image has functional alt text; every input has a label89- [ ] Full interface is operable by keyboard alone with visible focus90- [ ] Contrast ratios meet 4.5:1 (text) and 3:1 (large text/UI)91- [ ] Dynamic content is announced via aria-live92- [ ] Automated scans (axe/lighthouse) and manual tests (keyboard, screen reader, 200% zoom) pass