Skip to content

Accessibility Scans (a11y) ​

wdg <project> a11y run checks a project's local site for accessibility issues and gives a pass or fail you can use in a script. Each run starts a throwaway container, scans the pages you name, saves the results under the project, and removes the container.

The scanner is Siteimprove Alfa, which runs the ACT rules for WCAG, plus a keyboard probe that tabs through each page and flags focus that goes missing, lands off screen, or has no visible indicator. Both run in Playwright Chromium.

Usage ​

bash
wdg my-site a11y run                                  # scan the home page
wdg my-site a11y run --paths=/,/about/,/events/       # scan several pages
wdg my-site a11y run --standard=WCAG21AA --max-errors=5
OptionDefaultMeaning
--paths=CSV/Comma-separated paths on the local site. A full URL is accepted when it is on the project's own local address.
--standard=NAMEWCAG22AAOne of WCAG2A, WCAG2AA, WCAG2AAA, WCAG21AA, WCAG22A, WCAG22AA, WCAG22AAA.
--max-errors=N0The most errors a run can have and still pass.

The project and core services must be running (wdg start, wdg my-site start).

Exit codes ​

CodeMeaning
0Every page was scanned and the error count is at or below --max-errors.
2The error count is above --max-errors.
1Something stopped the scan: a bad option, a service that is not running, an image build failure, a page that could not be scanned, or a scanner crash.

A run where the error count passes but a page could not be scanned exits 1, because a pass that skipped pages is not a pass. Only error findings count toward the gate. Warnings are not collected in this version.

Local sites only ​

The scanner refuses anything that is not the project's own local site, https://<project>.localhost:<port>. A path must start with a single /. Another host, another project, another port, http:// and //host are all rejected before a container starts. Inside the container, the scanner follows each page's redirects before the browser opens it, and a page that redirects anywhere else is reported as not scanned.

Results ​

Each run writes to projects/<project>/accessibility/runs/<timestamp>/:

FileContents
run.jsonThe run: standard, gate verdict, engine versions, one entry per page, and counts per WCAG criterion.
pages/<n>.jsonEvery finding for page n, plus the keyboard journey (each Tab step and what received focus).
findings.csvOne row per finding across all pages, for a spreadsheet. Cells that start with =, +, - or @ are prefixed with ' so a spreadsheet shows them as text.
screenshots/A full-page capture per page, a crop of each finding's element outlined in magenta, before and after crops for keyboard focus findings, and the focus-order capture.

Every finding has the same fields: id, source (alfa or keyboard), rule, code, wcag (sc and level, or null when the rule maps to no single criterion), severity, message, selector, context_html, screenshot, box and keyboard_evidence.

The command prints progress for each page, then a summary per page and per WCAG criterion:

Pages:
  [0] https://my-site.localhost:6443/  9 errors, 0 warnings

By WCAG criterion:
  1.4.1 A   2 errors, 0 warnings on 1 page(s)
  2.4.3 A   1 errors, 0 warnings on 1 page(s)
  2.4.7 AA  6 errors, 0 warnings on 1 page(s)

FAIL: 9 errors (max 0)

How it works ​

The scanner code lives in cli/templates/a11y/: scan.js, its lib/ modules, and the vendored engine in vendor/a11y-engine/. That folder is mounted read-only into the container on every run, so an update to the platform reaches the next scan without a rebuild.

The Node packages (Alfa 0.82.0, Playwright 1.59.1, pngjs 7.0.0) are installed into a small image built from cli/templates/a11y/Dockerfile on top of mcr.microsoft.com/playwright:v1.59.1-noble. The image tag is a hash of the Dockerfile, package.json and package-lock.json. The first run builds it, later runs reuse it, and a change to any of those three files builds a new one.

The container joins wdg-network and runs as your user. The browser has to load the canonical https://<project>.localhost:<port> address, because WordPress redirects to it, and the platform proxy only publishes that port on your machine's loopback. The scanner therefore listens on that port inside the container, forwards each connection to wdg-nginx:443, and points the project hostname at the container's own loopback.

cli/templates/a11y/vendor/a11y-engine/PROVENANCE.md records where the engine came from. Run drift-check.sh in the same folder to confirm it still matches its upstream pin.