Activate the accessibility check
How-to
Offer 'Check this page for accessibility problems' under 'Send feedback', so testers and users can run an automatic check and report what it finds. It is active by default; this topic says how to choose the engine or turn it off.
Steps
- Keep
"check"in the list of what people can send. It is in the default list. If you settypes, add it:
Snaglist.start({ types: ["bug", "ux", "feature", "check"] });
- Choose the engine: - Built in (the default): 13 checks for the most common problems, each with how to fix it and example code. Nothing else is loaded. - axe-core: about 90 rules from Deque's open-source checker, with a link to the fix for each. Snaglist loads it from jsDelivr only when someone runs the check, and checks it against its known hash, so a changed file never runs.
Snaglist.start({ check: { engine: "axe" } });
- To load axe-core from your own server instead, download
axe.min.jsfrom the axe-core releases, put it with your site's files, and point Snaglist at it:
Snaglist.start({ check: { engine: "axe", axe: "/js/axe.min.js" } });
On another site's server, add the file's hash too, so a changed file never runs:
check: { engine: "axe", axe: "https://…/axe.min.js", integrity: "sha384-…" }.
- Run the check on your own pages: Check a page for accessibility problems.
Things to note
- Reports from the check have the label
accessibilityand the typecheckon GitHub. - To leave the check out, remove
"check"fromtypes. - To check many pages without anyone selecting a button, run axe-core in your tests (for example with
Playwright and
@axe-core/playwright), and keep Snaglist for what people find. - The built-in contrast check reads up to 300 pieces of text a run. Change it with
check: { contrastLimit: 600 }.