Testland
Browse all skills & agents

lighthouse-a11y

Configures Lighthouse CI's Accessibility category for automated accessibility testing (a11y / WCAG coverage) - `categories:accessibility` audits backed by axe-core (axe) - with per-URL minimum-score assertions (fail a build when a page's score drops below a threshold) and per-audit overrides, distinct from the Performance category that `lighthouse-perf` covers. Use when the project already runs Lighthouse CI for Web Vitals and the team wants to add accessibility coverage in the same pipeline rather than spinning up a separate scanner.

Install with skills.sh (any agent)

npx skills add testland/qa --skill lighthouse-a11y
View source

lighthouse-a11y

Overview

Lighthouse CI ships five audit categories: Performance, Accessibility, Best Practices, SEO, and Progressive Web App. The Accessibility category runs a curated subset of axe-core rules (lhci (opens in new window)). Configuring it via the same lighthouserc.js that lighthouse-perf uses keeps the audit pipeline unified.

This skill is the a11y slice of Lighthouse CI; lighthouse-perf is the Web Vitals slice. Both consume the same config; one CI run produces both reports.

When to use

  • The project already uses Lighthouse CI for performance.
  • The team wants a single tool reporting both perf and a11y.
  • Coverage at the page level is sufficient (Lighthouse runs against full URLs; for component-level coverage, use axe-a11y in unit/integration tests).
  • The team wants the Lighthouse score-style summary (e.g. "Accessibility: 92 / 100") rather than per-rule violation counts.

If the project doesn't already use Lighthouse CI, prefer axe-a11y directly - Lighthouse adds a layer.

How to use

  1. Confirm the project already runs Lighthouse CI (see When to use); if not, prefer axe-a11y directly.
  2. Install the CLI (npm install --save-dev @lhci/cli).
  3. Add the accessibility assertions to .lighthouserc.js alongside any perf assertions - the categories:accessibility category score plus per-audit overrides on critical rules (Worked example).
  4. Run npx lhci autorun to collect, assert, and upload in one pass.
  5. Verify: confirm the assert phase reports every assertion passing locally before merging; if one fails, fix the flagged audit (or relax an over-strict minScore) and re-run npx lhci autorun until green.
  6. Gate CI on the assertions and tighten minScore over time - per-URL thresholds, the full audit-ID reference, and the GitHub Actions workflow live in references/advanced-config-and-ci.md.

Install

(Same as lighthouse-perf.)

npm install --save-dev @lhci/cli

Worked example

Add the a11y assertions to the same .lighthouserc.js that lighthouse-perf uses for Web Vitals, so one config drives both categories:

// .lighthouserc.js
module.exports = {
  ci: {
    collect: {
      url: [
        'http://localhost:3000/',
        'http://localhost:3000/dashboard',
        'http://localhost:3000/checkout',
      ],
      numberOfRuns: 3,
      settings: {
        preset: 'desktop',
        chromeFlags: '--no-sandbox',
      },
      startServerCommand: 'npm run start',
    },
    assert: {
      assertions: {
        // Performance
        'largest-contentful-paint': ['error', { maxNumericValue: 2500 }],
        'interaction-to-next-paint': ['error', { maxNumericValue: 200 }],
        'cumulative-layout-shift':   ['error', { maxNumericValue: 0.1 }],

        // Accessibility - category score (0-1)
        'categories:accessibility':  ['error', { minScore: 0.95 }],

        // Per-audit overrides - error on critical-impact a11y rules
        'aria-required-attr':         ['error', { minScore: 1 }],
        'button-name':                ['error', { minScore: 1 }],
        'label':                      ['error', { minScore: 1 }],
        'meta-viewport':              ['error', { minScore: 1 }],

        // Lower-impact a11y rules - warn but don't block
        'color-contrast':             ['warn',  { minScore: 1 }],
        'image-alt':                  ['warn',  { minScore: 1 }],
      },
    },
    upload: { target: 'temporary-public-storage' },
  },
};

Per lhci (opens in new window), assertion levels are 'error' (CI fails), 'warn' (surfaced but doesn't fail), and 'off' (disabled).

Then run all three phases (collect / assert / upload) in one pass:

npx lhci autorun

The same command and flags (--collect.url, etc.) serve both perf and a11y assertions. The Accessibility category score (0 - 1) reflects axe-rule pass rate weighted by severity. A score of 1.0 doesn't mean perfect a11y - manual testing per screen-reader-test-author remains essential, so assert specific audit IDs (button-name, label, ...) in addition to the category score. The full audit-ID reference, per-URL thresholds via assertMatrix, and the CI workflow live in references/advanced-config-and-ci.md.

Anti-patterns

Anti-patternWhy it failsFix
Asserting only the category scoreA score of 1.0 hides per-rule details; can't pinpoint regressions.Assert specific audit IDs in addition to the category score.
Setting categories:accessibility minScore: 1Strict; a single moderate-severity rule failure blocks every PR.Start with minScore: 0.95; tighten over time.
Running only on the homepageMost a11y bugs live on form-heavy / dynamic pages.Audit a representative URL set.
Disabling the a11y category to "fix later""Later" never arrives.Use a11y-violation-gate ratchet pattern.
Treating Lighthouse score as the gold standardLighthouse covers ~50-60% of WCAG; doesn't catch ARIA misuse, screen-reader issues, keyboard-only flow bugs.Pair with manual testing + dedicated axe-a11y component scans.

Limitations

  • Page-level only. Lighthouse audits whole pages; per-component coverage isn't supported. Use axe-a11y in unit/integration tests for component-level.
  • Subset of axe rules. Lighthouse's accessibility category doesn't run every axe rule; for complete axe coverage, use axe-a11y directly.
  • Throttled environment. Lighthouse simulates throttled network/CPU; some a11y issues only manifest at production speeds (rare but real). Confirm with a non-throttled scan if suspicious.

References

  • lhci (opens in new window) - Lighthouse CI install, lhci autorun, configuration shape, assertion levels.
  • Per-URL assertMatrix thresholds, the full accessibility audit-ID table, and the GitHub Actions workflow: references/advanced-config-and-ci.md.
  • lighthouse-perf - sibling skill for the Performance / Web Vitals category in the same Lighthouse run.
  • axe-a11y - direct axe-core usage for component-level coverage.
  • a11y-violation-gate - CI gate consuming Lighthouse a11y output.
  • W3C WCAG 2.2 - https://www.w3.org/TR/WCAG22/

Lighthouse a11y - per-URL config, audit IDs, and CI

View source (opens in new window)

Lighthouse a11y - per-URL config, audit IDs, and CI

Deep reference for lighthouse-a11y SKILL.md. Consult when pages need different score bars, when mapping a failing audit ID to what it checks, or when wiring the audit into GitHub Actions. SKILL.md keeps the single-config first run and points here for the rest.

Per-URL thresholds with assertMatrix

assert.assertions applies one threshold set to every collected URL. When pages need different bars (a marketing homepage at 0.90, a checkout at 0.98), use assertMatrix instead: an array where each entry pairs a matchingUrlPattern (a regex matched against the audited URL) with its own assertions block (lhci (opens in new window)). assertMatrix and assertions are mutually exclusive at the assert level, and the first matching pattern wins, so order specific patterns before the catch-all:

// .lighthouserc.js - different a11y bars per URL
module.exports = {
  ci: {
    assert: {
      assertMatrix: [
        {
          matchingUrlPattern: '.*/checkout.*',
          assertions: {
            'categories:accessibility': ['error', { minScore: 0.98 }],
            'color-contrast':           ['warn'],
          },
        },
        {
          matchingUrlPattern: '.*',
          assertions: {
            'categories:accessibility': ['error', { minScore: 0.90 }],
            'color-contrast':           ['warn'],
          },
        },
      ],
    },
  },
};

Accessibility audit IDs

Lighthouse's accessibility category runs a curated set of axe-core rules. The category score (0 - 1) reflects rule pass rate weighted by severity. Common per-audit IDs (used in assertions:):

Audit IDWhat it checks
aria-allowed-attrARIA attributes are valid for the element's role.
aria-hidden-bodyaria-hidden not on <body>.
aria-required-attrRequired ARIA attributes for the role are present.
aria-required-childrenRequired ARIA children are present.
aria-rolesValid ARIA roles only.
aria-valid-attrARIA attribute names are valid.
aria-valid-attr-valueARIA attribute values are valid.
button-nameButtons have accessible names.
bypassSkip-link or landmark for bypassing repeated content.
color-contrastForeground / background contrast ≥ 4.5:1 (or 3:1 large).
document-title<title> is set.
duplicate-id-activeNo duplicate id on focusable elements.
form-field-multiple-labelsForm fields don't have multiple labels.
frame-title<iframe> has a title attribute.
html-has-lang<html> has lang.
image-alt<img> has alt.
labelForm fields have associated labels.
link-nameLinks have accessible names.
list<ul> / <ol> only contain <li>.
listitem<li> is inside a <ul> / <ol>.
meta-viewport<meta name="viewport"> doesn't disable zoom.
tabindexNo tabindex > 0.
valid-langlang attribute is valid.

(Per lhci (opens in new window); full list in Lighthouse's accessibility audit documentation.)

CI integration

(See the same workflow in lighthouse-perf - one workflow runs both.)

# .github/workflows/lighthouse.yml
name: lighthouse

on:
  pull_request:
    paths:
      - 'src/**'
      - 'package.json'

jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v4
        with: { node-version: '20', cache: 'npm' }
      - run: npm ci
      - run: npm run build
      - run: npx lhci autorun
        env:
          LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
      - if: always()
        uses: actions/upload-artifact@v4
        with: { name: lighthouse-reports, path: .lighthouseci/ }

Related skills

a11y-violation-gate

Builds a CI gate that fails the build on **new** WCAG / a11y violations introduced by a PR while grandfathering pre-existing violations on a per-rule / per-page baseline. Aggregates verdicts from axe-core / pa11y / Lighthouse a11y / WAVE / IBM Equal Access scans. Use when a project has accumulated a11y debt and a strict "zero violations" gate would block every PR - the ratchet pattern lets the team ship while preventing regressions.

aria-authoring-patterns

Reference for the W3C ARIA Authoring Practices Guide (APG) - covers the 31 canonical interactive-widget patterns (Combobox, Dialog, Menu, Tabs, Tree, etc.), their required ARIA roles and states, the keyboard-interaction model per pattern, and the canonical-violations to watch for. Use when authoring a custom interactive widget that doesn't have a native HTML equivalent, or when reviewing one for ARIA correctness.

axe-a11y

Authors and runs axe-core accessibility scans - the most-deployed open-source a11y engine - via the `axe.run()` JavaScript API or the @axe-core/playwright / @axe-core/cli wrappers, parses the `violations[]` results into per-rule severity (critical / serious / moderate / minor), configures rule disable / disable-by-tag patterns, and emits JUnit-shaped output for CI gating. Use when the project ships UI tests in JavaScript / TypeScript and wants automated a11y coverage on every PR.

ibm-equal-access-a11y

Authors and runs IBM Equal Access accessibility-checker scans - IBM's open-source a11y engine with WCAG 2.0 / 2.1 / 2.2 + US Section 508 rule sets, integrating with Node / Selenium / Puppeteer / Playwright / Karma / Cypress test runners. Distinguished by IBM's enterprise-tier rule coverage and Section 508 specificity. Use when the project ships to US federal / public-sector customers (Section 508 mandate) or when the team values IBM-branded a11y reporting.

pa11y-a11y

Authors and runs pa11y accessibility scans - a CLI / Node.js tool that wraps HTML CodeSniffer (htmlcs) and / or axe-core engines - with `pa11y {url}` invocation, reporter selection (cli / csv / json / html / tsv), WCAG standard selection (WCAG2A / WCAG2AA / WCAG2AAA), and rule ignoring. Use when the project needs scriptable a11y scans without a full test framework, or when a Node-stack project wants an alternative to direct axe-core use.

screen-reader-test-author

Builds a screen-reader test narrative - a step-by-step manual test script for NVDA (Windows), JAWS (Windows), VoiceOver (macOS / iOS), or TalkBack (Android) - that exercises a specific user flow through a component or page and captures the expected announcement at each step. Use when authoring an accessibility-acceptance test the team will run before sign-off, OR when scripting a manual a11y audit.

wave-a11y

Runs WebAIM WAVE accessibility scans via the WAVE API or the browser-extension UI - produces visual overlay of errors / alerts / structural elements directly on the page, plus categorized JSON output for CI use. Use when the team values manual-review-friendly visual feedback (the WAVE overlay) alongside automated CI scans, or when a regulatory audit requires WebAIM-branded reports.

wcag-checklist-builder

Builds a per-component WCAG 2.2 accessibility checklist from a component spec - covers focus management, color contrast, ARIA roles & states, keyboard interaction, error handling, and live-region announcements - emitting a markdown checklist or YAML test plan that pairs with screen-reader-test-author for manual verification and the violation gate for automated scans. Use during component-spec review or pre-implementation acceptance.

wcag-color-contrast

Reference for WCAG 2.2 color-contrast conformance - covers SC 1.4.3 Contrast (Minimum, AA), 1.4.6 Contrast (Enhanced, AAA), 1.4.11 Non-text Contrast (AA), and 1.4.13 Content on Hover or Focus (AA) - with the canonical contrast ratios (4.5:1 normal text, 3:1 large text and UI components), measurement formula references, and bulk design-token checking patterns. Use when designing a color palette, reviewing a component for accessibility, or auditing existing CSS for contrast violations.

wcag-compliance-reporter

Builds a per-page WCAG 2.2 compliance score report by aggregating output from one or more accessibility scanners (axe-core / pa11y / lighthouse / WAVE / IBM Equal Access), pivoting violations by Success Criterion (1.4.3 contrast, 2.4.7 focus visible, etc.), grouping by conformance level (A / AA / AAA), reporting per-page coverage gaps explicitly (the "this page wasn't scanned" failure mode), and emitting both an executive summary and a per-page drill-down. Use after a multi-page accessibility scan - pa11y-ci, axe across a sitemap, lighthouse-batch - when the team needs a shareable conformance report rather than a per-page tool dump.

wcag-focus-trap

Reference for **intentional** focus management in modal / dialog / drawer / popover components - the canonical pattern that satisfies WCAG SC 2.4.3 (Focus Order) without violating SC 2.1.2 (No Keyboard Trap). Covers focus-on-open, focus-cycle-within-container, Escape-closes-and-restores, return-to-trigger, and inert-the-rest-of-the-page. Use when authoring or reviewing any component that displays content over the page (modals, drawers, popovers, command palettes).

wcag-keyboard-navigation

Reference catalog for WCAG 2.2 keyboard-navigation conformance - covers SC 2.1.1 (Keyboard), 2.1.2 (No Keyboard Trap), 2.1.4 (Character Key Shortcuts), 2.4.3 (Focus Order), 2.4.7 (Focus Visible), 2.4.11/2.4.12 (Focus Not Obscured) - with conformance levels (A/AA), test scripts, and per-criterion failure patterns. Use when authoring or reviewing keyboard-only interaction support.

widget-a11y-test-matrix

Per-widget manual accessibility test matrices where every row pairs one keystroke with the expected focus behavior, the expected NVDA announcement, the expected VoiceOver announcement, and the WCAG 2.2 success criterion that row verifies. Covers button, toggle button, checkbox, text input, modal dialog, menu button, and combobox archetypes, plus universal Tab traversal. Use when a rendered widget has cleared automated scanning and a tester needs a fill-in pass/fail sheet to run by hand against NVDA and VoiceOver.