---
title: Accessibility checks
description: Run docslit check a11y to test every page of a built site against WCAG rules in light and dark themes, and fail CI when violations reach a chosen severity.
tag: CLI reference
readtime: 4 min read
---
> For AI agents: the complete documentation index is at [llms.txt](https://docs.docslit.com/0.3/llms.txt). This page as Markdown: [cli-reference/accessibility.md](https://docs.docslit.com/0.3/cli-reference/accessibility.md).


# Accessibility checks

`docslit check a11y` runs [axe-core](https://github.com/dequelabs/axe-core) in headless Chromium against a built site. It finds problems that [`validate`](validation) and [`lint`](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:

```bash
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:

```bash
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.

```bash
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
```

<wc-fields header="Options">
<wc-field name="--out" type="string" default="dist">
The built site directory to check.
</wc-field>
<wc-field name="--level" type="string" default="wcag2aa">
The rule set to apply: `wcag2a`, `wcag2aa`, `wcag21aa` or `wcag22aa`.
</wc-field>
<wc-field name="--theme" type="string" default="both">
The theme to test: `light`, `dark` or `both`.
</wc-field>
<wc-field name="--pages" type="string">
Comma-separated page ids to check. By default, every page is checked.
</wc-field>
<wc-field name="--max" type="number">
Check at most this many pages.
</wc-field>
<wc-field name="--format" type="string" default="text">
`text`, `json` or `github` (Actions annotations).
</wc-field>
<wc-field name="--fail-on" type="string" default="serious">
The lowest impact that fails the run: `minor`, `moderate`, `serious` or `critical`.
</wc-field>
</wc-fields>

## Exit codes

<wc-fields header="Exit codes">
<wc-field name="0" type="number">
No violation at or above the `--fail-on` impact.
</wc-field>
<wc-field name="1" type="number">
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.
</wc-field>
</wc-fields>

## Run it in GitHub Actions

```yaml filename=".github/workflows/a11y.yml"
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.
