Repository navigation
feat(rules): tag a11y rules with WCAG criterion and level, add --wcag-level (repo#3093) - #2024
Merged
Merged
Conversation
nc9
force-pushed
the
boat/wcag-tags-3093
branch
5 times, most recently
from
November 17, 2026 17:38
d231010 to
f553ccf
Compare
2 tasks
nc9
force-pushed
the
boat/wcag-tags-3093
branch
2 times, most recently
from
November 17, 2026 18:30
a71fe26 to
d1a8e41
Compare
Contributor
Author
|
Merge approved on 2026-11-18. This PR is over the 40-file threshold, so the merge needed a maintainer's go. Reviewed at Follow-ups tracked separately: the cloud keeping the WCAG fields through publish, the API honouring the partial-audit marker, and the agent skill mentioning nik |
nc9
force-pushed
the
boat/wcag-tags-3093
branch
from
November 17, 2026 20:00
d1a8e41 to
2859523
Compare
6 tasks done
nc9
force-pushed
the
boat/wcag-tags-3093
branch
from
November 17, 2026 20:06
2859523 to
c3de705
Compare
nc9
marked this pull request as ready for review
November 17, 2026 20:25
…dd --wcag-level (repo#3093) Signed-off-by: Nik Cubrilovic <[email protected]>
…chema 1.25, not a CLI version (repo#1082) Signed-off-by: Nik Cubrilovic <[email protected]>
…ith the reason; duplicate-id-aria maps to 4.1.2 (repo#3093) RuleMeta gains wcagNone, and every a11y rule declares exactly one of wcag or wcagNone. accesskeys, input-types, duplicate-id-active, heading-order, landmark-one-main, landmark-regions, table-duplicate-name, image-redundant-alt, aria-text and paste-inputs move to wcagNone (paste-inputs narrowing is #2106). --wcag-level runs only mapped rules, so it leaves those out at every level. No rule's run() changes. The generated rule pages show the reason, and the intro, now inside the markers, says the checks do not prove conformance. Signed-off-by: Nik Cubrilovic <[email protected]>
…the level; refuse an include the level empties (repo#3093) buildPartialAudit records wcagLevel for a run narrowed by --wcag-level or [rules] wcag_level, and every renderer names it (text, markdown, console, json meta.partialAudit.wcagLevel, xml wcag-level). The zero-rules pre-check sees the level's disables, so --rule-include a11y/touch-targets --wcag-level AA is refused before the crawl. Wording: --wcag-level only runs the rules mapped to a criterion at or below the level, and passing them does not mean a site conforms. The HTML line counts accessibility rules with findings. Bash completion lists --wcag-level once and completes A AA AAA. Signed-off-by: Nik Cubrilovic <[email protected]>
…partialAudit on main, 1.26 reserved for cacheFreshness, pub#2045) Signed-off-by: Nik Cubrilovic <[email protected]>
…G-level or rule-filtered run (repo#3093, repo#1082) Signed-off-by: Nik Cubrilovic <[email protected]>
…rd: no auto-publish, skipped as rule-filter (repo#3093) Signed-off-by: Nik Cubrilovic <[email protected]>
… WCAG 2.2 has no 4.1.1 (repo#3093) Signed-off-by: Nik Cubrilovic <[email protected]>
… level, and is not auto-published (repo#3093) Signed-off-by: Nik Cubrilovic <[email protected]>
…in in landmark-regions wcagNone #3093 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
boat/wcag-tags-3093
branch
from
November 17, 2026 20:38
c3de705 to
5ce4dac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tags the a11y rules with WCAG success criteria as data and adds a level filter. Part of squirrelscan/repo#3086, implements squirrelscan/repo#3093.
What changed
packages/core-contracts/src/wcag.ts: one table of criteria (title, level, version);wcag("1.4.3")builds a rule's entry so a rule cannot state the wrong level. Unknown criteria throw at load.meta.wcag(52 rules) ormeta.wcagNone(10 rules), a one-sentence reason grounded in what its run() checks: accesskeys, input-types, duplicate-id-active, heading-order, landmark-one-main, landmark-regions, table-duplicate-name, image-redundant-alt, aria-text, paste-inputs (its run() covers any text field, not only authentication fields; narrowing it is a11y/paste-inputs: scope paste blocking to authentication fields so it can carry WCAG 3.3.8 #2106).a11y/duplicate-id-ariamaps to 4.1.2. No rule's run() changes.meta.partialAuditis on main; 1.26 reserved for cacheFreshness, pub#2045):wcagandwcagLevelon a11y issues, top-levelwcagByLevel,meta.partialAudit.wcagLevel. HTML (footer line,data-wcag-level, "Accessibility rules with findings, by WCAG level"), Markdown and text reports show criterion and level.squirrel audit --wcag-level A|AA|AAAand[rules] wcag_level: Only run the accessibility rules mapped to a WCAG success criterion at or below this level: A, AA or AAA (AA keeps Level A and AA). These automated checks cover part of WCAG; passing them does not mean a site conforms. A multi-criterion rule runs if any criterion is at or below the level; awcagNonerule does not run. Implemented as exact-id disable patterns for a11y rules only.buildPartialAudit) naming the level, in every format and the publish payload.--rule-include a11y/touch-targets --wcag-level AAis refused before the crawl.--wcag-levelonce and completesA AA AAA, like zsh and fish.docs/scripts/rule-wcag.tsgenerates the## WCAG success criteriablock on every a11y rule page (intro inside the markers; "No WCAG success criterion: " forwcagNone);--checkand its new test run inmake validate.a11y/touch-targetscuts off at 44px, which is 2.5.5 (AAA), so it is tagged 2.5.5 AAA and its advice says the AA minimum (2.5.8) is 24px. It does not run under--wcag-level AA.chore(report): ... JSON schema 1.27), version lines only.Acceptance criteria
packages/rules/tests/a11y-wcag.test.ts("every a11y rule declares exactly one of wcag or wcagNone", "a wcagNone reason is one non-empty sentence", "the rules that test no WCAG success criterion say why")packages/report/tests/json-wcag-3093.test.ts--wcag-level,[rules] wcag_level;apps/cli/tests/self/completion.test.ts("audit --wcag-level completion")apps/cli/tests/controllers/partial-audit-1082.test.ts,apps/cli/tests/reports/output/console.test.ts,json-wcag-3093.test.tsdocs/scripts/rule-wcag.ts+docs/scripts/rule-wcag.test.ts,make validatepasseswcagNonerules)Verification
bun test --timeout 30000, explicit files: packages/rules a11y-wcag, rule-verdict-scope, rule-check-declarations, docs-rule-pages: 393 pass. packages/report json-wcag-3093, json-pages-1260, robots-honoured-1782: 22 pass. apps/cli completion, partial-audit-1082, console, rule-filter: 181 pass; audit-include-pages-e2e, audit-unstored-pages-1396-e2e, reconstruct-page-rule-counts-1260: 15 pass; partial-audit-rebuild-1082, partial-audit-report-1082-e2e: 4 pass. docs scripts glossary, check-links, rule-wcag: 66 pass.zeroRulesError), rule-wcag.test 3 fail.format:checkandlintclean.make validatein docs/: tangly all checks passed, links good, glossary good, rule-checks and rule-wcag--checkclean, 66 tests pass.No new rule, so no rule counts change. Agent skill: a private follow-up is filed, squirrelscan/repo#4835.