audit-accessibility-wcag
Skill9 starsChanged 5 months agoApache-2.0View on GitHub
Audits and fixes markup/JSX for WCAG 2.2 AA compliance — alt text, ARIA, heading order, contrast, keyboard nav, focus management; used before shipping UI or preparing an a11y review.
In this repository147 other files it gives its agents.
- second-brain/AGENTS.mdAGENTS.md
- second-brain/CLAUDE.mdCLAUDE.md
- agent-tool-mcp-builderSkill
- api-design-reviewSkill
- async-concurrency-correctnessSkill
- audit-license-complianceSkill
- audit-technical-seoSkill
- auth-jwt-sessionSkill
- author-codemodSkill
- brainstorm-designSkill
- build-audit-loggingSkill
- build-cdc-streaming-pipelineSkill
- build-cli-toolSkill
- build-data-tableSkill
- build-etl-pipelineSkill
- build-form-validationSkill
- build-native-mobile-uiSkill
- build-office-docsSkill
- build-offline-first-syncSkill
- build-react-componentSkill
- build-realtime-channelSkill
- build-spreadsheetSkill
- build-vector-searchSkill
- caching-strategySkill
- cicd-pipeline-authorSkill
- cloud-cost-optimizeSkill
- code-commentsSkill
- code-reviewSkill
- compose-local-dev-stackSkill
- configure-bundler-buildSkill
- configure-dns-tlsSkill
- configure-reverse-proxy-lbSkill
- configure-security-headers-cspSkill
- contract-testingSkill
- datetime-timezone-correctnessSkill
- db-migration-safetySkill
- debug-ci-pipeline-failureSkill
- debug-flaky-testsSkill
- debug-frontend-browserSkill
- debug-root-causeSkill
- defend-llm-prompt-injectionSkill
- deliver-webhooksSkill
- dependency-upgradeSkill
- deploy-releaseSkill
- design-api-paginationSkill
- design-authorization-modelSkill
- design-backup-dr-recoverySkill
- design-event-sourcing-cqrsSkill
- design-multi-tenancySkill
- design-protobuf-grpc-serviceSkill
- design-relational-schemaSkill
- design-search-index-infraSkill
- design-state-machineSkill
- design-token-systemSkill
- diff-table-paritySkill
- distributed-locks-leasesSkill
- dockerfile-optimizeSkill
- encrypt-sensitive-dataSkill
- error-messageSkill
- estimate-workSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
NOT this skill: pure visual/layout polish (no a11y intent), or security/XSS concerns — that is security-review.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When to Use
Trigger this skill when the task is to audit or fix UI for accessibility: WCAG 2.2 AA, screen readers, ARIA, keyboard nav, color contrast, focus management, or preparing an a11y review.
NOT this skill: pure visual/layout polish (no a11y intent), or security/XSS concerns — that is security-review. ARIA/role injection that touches dangerouslySetInnerHTML or user-controlled markup overlaps both; flag the a11y part here and hand the injection risk to security-review.
Steps
Work in this order. Earlier rules outrank later ones — never reach for ARIA to patch a problem that semantic HTML already solves.
- Scope the surface. Identify the files/components in the diff or named target. Grep for the smells that produce most findings:
rg -n 'role=|aria-|onClick=|<div|<span|tabindex|tabIndex|alt=|<img|placeholder='across the target. Build a checklist; do not audit the whole repo unless asked. - Semantic HTML first. Replace
<div onClick>/<span onClick>with a real<button type="button">. Use<a href>only for navigation (has a destination),<button>for actions (no navigation). Use<nav>,<main>,<header>,<footer>,<ul>/<li>,<table>over<div role="...">. One<main>per page. A native element is keyboard-operable and announced for free; a styleddivis not. - Images & icons. Every
<img>needsalt. Informative image → describe its meaning (alt="Quarterly revenue up 12%"), not the filename. Decorative/redundant image →alt=""(empty, not missing — missing alt makes SRs read the URL). Icon-only buttons need an accessible name viaaria-labelor visually-hidden text; an inline SVG that conveys meaning needsrole="img"+aria-label, a decorative one needsaria-hidden="true". - Heading hierarchy. Exactly one
<h1>. No skipped levels (h2 → h4 is a fail; reflows the SR outline). Headings describe structure, not font size — never pick a level for its default styling. Don't fake headings with bold<p>/<div>. - ARIA only where native fails. First rule of ARIA: don't use ARIA. Apply it only for patterns HTML can't express (tabs, comboboxes, live regions, disclosure). When you do: every
rolemust carry its required states (e.g.role="tab"needsaria-selected+aria-controls;aria-expandedon every disclosure/menu trigger;role="dialog"needsaria-modal="true"+aria-labelledby). Never put an interactive role on a non-interactive element without also making it focusable (tabindex="0") and key-handled. Remove redundant roles (role="button"on a<button>). - Forms. Every input has a programmatic label:
<label for>/htmlFor, wrapping<label>, oraria-label/aria-labelledby. Placeholder is NOT a label (vanishes on input, low contrast). Required →required+ visible indicator. Errors: link the message witharia-describedbyon the field, setaria-invalid="true", and announce dynamic errors via anaria-live="polite"(orrole="alert"for assertive) region. Group radios/related fields in<fieldset>+<legend>. - Color contrast (WCAG 2.2 AA). Body text ≥ 4.5:1; large text (≥ 24px, or ≥ 18.66px bold) ≥ 3:1; UI components, icons, and focus indicators ≥ 3:1 against adjacent colors. Compute ratios from the actual hex values (resolve CSS vars/Tailwind tokens to real colors first). Never rely on color alone to convey state — pair it with text/icon/shape. Check disabled, hover, and dark-mode states too.
- Keyboard. Everything operable by mouse must work by keyboard. Tab order follows DOM order — fix with DOM/flexbox
orderreasoning, never positivetabindex(1+).tabindex="-1"= focusable by script only;0= in natural order. Every interactive element needs a visible focus indicator — do NOToutline: nonewithout a replacement (:focus-visiblering). Add a "Skip to main content" link as the first focusable element. No keyboard traps (you can Tab out of every widget). Custom widgets implement expected keys (Esc closes, Arrow keys move within tabs/menus/listbox per ARIA APG). - Focus management (dynamic UI). On modal/dialog open: move focus into it, trap Tab within it, restore focus to the trigger on close, Esc closes. On client-side route change: move focus to the new page's
<h1>or a focusable container so SR users aren't stranded. Toasts/async results → announce via live region, don't steal focus mid-task. - Report. Output a prioritized list grouped Blocker → Major → Minor, each entry = file:line, the WCAG criterion (e.g. 1.1.1, 2.4.7), the concrete problem, and a copy-pasteable fix (before → after). Blocker = blocks a user from completing a task (unlabeled control, keyboard trap, no focus on modal). Major = significant barrier (contrast fail, skipped heading). Minor = friction (redundant role, missing
lang). Apply the fixes when asked; otherwise leave them as ready-to-paste diffs.
Common Errors
alt=""vs missingalt— empty is intentional "decorative, skip me"; missing makes SRs announce the file path. Not interchangeable.- Placeholder used as the only label. Fails 1.3.1/4.1.2 and disappears once typing starts.
outline: none/outline: 0in a CSS reset with no:focus-visiblereplacement — silently removes the focus ring for keyboard users. Single most common keyboard fail.- Positive
tabindex("1", "2"…) to "fix" order — creates a brittle parallel tab sequence ahead of everything else. Fix DOM order instead. aria-labelon a non-interactive, non-role'd element (plain<div>/<span>/<p>) — most SRs ignore it. The name needs an element that takes a name.role="button"on a<div>withouttabindex="0"ANDonKeyDownfor Enter/Space — looks clickable, dead to keyboard. Just use<button>.- Click handler only on the icon
<svg>/<i>inside a control — enlarge the hit target and put the handler + name on the<button>. aria-hidden="true"on a focusable element (or an ancestor of one) — hides it from SRs while it stays in the tab order: a focusable ghost. Never wrap interactive content inaria-hidden.- Live region added to the DOM at the same time as its message — SRs only announce changes to an already-present region. Render the empty
aria-livecontainer first, then inject text. - Tailwind/utility color audit done on class names —
text-gray-400 on bg-whiteis not a contrast value. Resolve to hex, then compute the ratio. - Trusting the linter as "done" —
eslint-plugin-jsx-a11y/axe catch static markup issues only. They cannot see contrast against rendered backgrounds, focus order, trap behavior, or whether a name actually makes sense. Keyboard/SR behavior needs manual or automated runtime checks.
Verify
Static (always): rg -n 'outline:\s*(none|0)|tabindex=["\x27][1-9]|aria-hidden=["\x27]true' <target> returns no unjustified hits. If the project has it, run npx eslint --no-eslintrc --plugin jsx-a11y (or the existing a11y lint task) → zero errors. Confirm exactly one <h1> and no skipped heading levels.
Runtime (when a browser is available): load the page, run an axe-core scan (or lighthouse accessibility category) and capture the score + violations. Then keyboard-walk it: Tab from the top — every interactive element is reachable, in logical order, with a visible focus ring; the skip link appears first; open a modal and confirm focus enters it, Tab is trapped, Esc closes, and focus returns to the trigger.
Contrast: for each flagged pair, state the computed ratio and the threshold it must clear (4.5:1 / 3:1) — a fix isn't done until the number passes.
Report is complete only when every Blocker has a concrete code fix attached (not just a description) and each finding cites its WCAG success criterion.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

