Repository navigation
Description
The axe: accessibility checker runs axe-core's default rule set with no way to scope it.
E.g. A user that needs to meet a specific WCAG conformance level,
may want to turn off axe's best-practice rules, or only see violations relevant to their target level.
axe.run called in src/resources/formats/html/axe/axe-check.js takes a runOnly value to options like:
options.runOnly: { type: "tag", values: ["wcag22aa", "best-practice"] }
The tricky thing is that axe tags are not cumulative, a rule's WCAG version tag marks where its criterion was introduced, not every level it applies to.
I propose instead of a user feeding tags directly into runOnly, we introduce a standard option and propagate the list of tags ourselves.
E.g a user writes:
format:
html:
axe:
output: document
standard: wcag21aa
And we call axe.run with options.runOnly:
this.axe.run(
// 1st arg — context (what to scan): unchanged from today
{ exclude: ["[data-tabster-dummy]"] },
// 2nd arg — options: this is the new part
{
runOnly: {
type: "tag",
values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"],
},
preload: { assets: ["cssom"], timeout: 50000 },
}
);The mapping from standard to tag looks something like:
const STANDARD_TAGS = {
// WCAG 2.0
wcag2a: ["wcag2a"],
wcag2aa: ["wcag2a", "wcag2aa"],
wcag2aaa: ["wcag2a", "wcag2aa", "wcag2aaa"],
// WCAG 2.1
wcag21a: ["wcag2a", "wcag21a"],
wcag21aa: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"],
wcag21aaa: ["wcag2a", "wcag2aa", "wcag2aaa", "wcag21a", "wcag21aa"],
// WCAG 2.2
wcag22a: ["wcag2a", "wcag21a"],
wcag22aa: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"],
wcag22aaa: ["wcag2a", "wcag2aa", "wcag2aaa", "wcag21a", "wcag21aa", "wcag22aa"],
};We then might also allow a axe: best-practices: true/false option to control whether the tag best-practices is also added.
Activity
Add axe standard and best-practice options (#14607)
Add tests for axe standard/best-practice scoping (#14607)
Add Playwright test for standard without output (#14607)
Harden standard-scoping Playwright fixtures and assertions (#14607)
Add axe standard and best-practice options (#14607)
Add tests for axe standard/best-practice scoping (#14607)
Add Playwright test for standard without output (#14607)
Harden standard-scoping Playwright fixtures and assertions (#14607)
Add `standard` and `best-practice` options to `axe` (quarto-dev#14607) (
test(axe): expand accessibility regression coverage (#14713)
Document axe standard and best-practice options
Document axe `standard` and `best-practice` options (#2105)
Document axe `standard` and `best-practice` options (#2105) (#2132)