Accessibility checks

CLI reference•4 min read|
|

docslit check a11y runs axe-core in headless Chromium against a built site. It finds problems that validate and lint can't see, such as low color contrast, missing labels and invalid ARIA.

Set up

The check needs Playwright, axe-core and a Chromium browser in your project:

npm install -D playwright axe-core npx playwright install chromium

DocsLit finds both packages in your project even when you run it with npx.

Run the check

The command reads a built site, so build first:

docslit build docslit check a11y

DocsLit serves the output folder itself and respects basePath. For every page, it loads the page in a light and a dark theme, waits for components to load, and freezes animations so contrast is measured on the final colors.

docslit check a11y --level wcag21aa docslit check a11y --theme dark --pages guides/setup,guides/install docslit check a11y --max 20 --fail-on moderate docslit check a11y --format json The built site directory to check. The rule set to apply: wcag2a, wcag2aa, wcag21aa or wcag22aa. The theme to test: light, dark or both. Comma-separated page ids to check. By default, every page is checked. Check at most this many pages. text, json or github (Actions annotations). The lowest impact that fails the run: minor, moderate, serious or critical.

Exit codes

No violation at or above the --fail-on impact. At least one violation at or above the --fail-on impact, or the check couldn't run: Playwright or axe-core is missing, or the output folder has no built pages.

Run it in GitHub Actions

steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 24 - run: npm ci - run: npx playwright install --with-deps chromium - run: npx docslit build - run: npx docslit check a11y --format github

With --format github, each violation shows up as an annotation on the run.