ultra11y 5.54.0 → 5.54.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@
10
10
  "name": "ultra11y",
11
11
  "source": "./",
12
12
  "description": "RGAA 4.1.2 accessibility audits on a WCAG 2.2 AA core: automatic review before commit, push and pull request, plus dated, evidenced Markdown, HTML and per-page conformance reports in Claude Code.",
13
- "version": "5.54.0",
13
+ "version": "5.54.2",
14
14
  "author": { "name": "maxgfr" },
15
15
  "homepage": "https://github.com/SocialGouv/ultra11y",
16
16
  "repository": "https://github.com/SocialGouv/ultra11y",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ultra11y",
3
3
  "description": "RGAA 4.1.2 accessibility audits, the French State's standard, on a WCAG 2.2 AA core: automatic review before commit, push and pull request, plus dated, evidenced Markdown, HTML and per-page conformance reports. Never declares conforming what it has not verified.",
4
- "version": "5.54.0",
4
+ "version": "5.54.2",
5
5
  "author": { "name": "maxgfr" },
6
6
  "homepage": "https://github.com/SocialGouv/ultra11y",
7
7
  "repository": "https://github.com/SocialGouv/ultra11y",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ultra11y",
3
3
  "description": "RGAA 4.1.2 accessibility audits, the French State's standard, on a WCAG 2.2 AA core: automatic review before commit, push and pull request, plus dated, evidenced Markdown, HTML and per-page conformance reports. Never declares conforming what it has not verified.",
4
- "version": "5.54.0",
4
+ "version": "5.54.2",
5
5
  "author": { "name": "maxgfr", "url": "https://github.com/maxgfr" },
6
6
  "homepage": "https://github.com/SocialGouv/ultra11y",
7
7
  "repository": "https://github.com/SocialGouv/ultra11y",
@@ -27,7 +27,7 @@ import { fileURLToPath } from "node:url";
27
27
  // Ownership marker: `ultra11y install --opencode` refuses to overwrite a plugin file that
28
28
  // does not carry it, so a user's own ultra11y.js is never clobbered.
29
29
  const ULTRA11Y_OPENCODE_PLUGIN = "ULTRA11Y_OPENCODE_PLUGIN";
30
- const ULTRA11Y_PLUGIN_VERSION = "5.54.0";
30
+ const ULTRA11Y_PLUGIN_VERSION = "5.54.2";
31
31
 
32
32
  const here = dirname(fileURLToPath(import.meta.url));
33
33
 
package/README.md CHANGED
@@ -27,7 +27,7 @@ Full details, thresholds and off-switches under [Install](#install).</sub>
27
27
 
28
28
  > Audit a site against **RGAA 4.1.2**, the French State's accessibility standard (*référentiel général d'amélioration de l'accessibilité*), on its **WCAG 2.2 AA** core: a dated conformance report, the 106-criterion grid, a backlog and tickets — or author/review accessible markup without regressions. It never declares conforming what it has not verified. A [skills.sh](https://skills.sh) agent skill: a deterministic, zero-dependency static engine **plus** the agent's judgment, with `check`/`verify` gates against hallucinated non-conformities. **The central deliverable is the auditor conformance block** — theme, criterion + official wording, test(s), WCAG mapping + level, finding, expected state, verification, `file:line` occurrences — rendered identically by the `report` (compliance doc), the `prd` backlog and the GitHub issues, in the active standard's vocabulary and **in your language** (`--lang auto` follows the conversation/repo). **RGAA ships first; WCAG is the worldwide core it maps onto, and other country standards are pluggable in-repo packs.**
29
29
 
30
- ultra11y is built around an honest **division of labour**. Automated tools only catch a fraction of accessibility problems, so the engine does the *mechanical* work — 96 machine-detectable static checks tied to the WCAG 2.2 success criteria — and is explicit about everything it can't decide statically. What it can't, the **AI agent adjudicates** (statically, from the evidence, gated by `verify`/`check`) — not a deferral to a human:
30
+ ultra11y is built around an honest **division of labour**. Automated tools only catch a fraction of accessibility problems, so the engine does the *mechanical* work — 97 machine-detectable static checks tied to the WCAG 2.2 success criteria — and is explicit about everything it can't decide statically. What it can't, the **AI agent adjudicates** (statically, from the evidence, gated by `verify`/`check`) — not a deferral to a human:
31
31
 
32
32
  - **Automatable (engine):** missing `alt`/`lang`/`title`, unlabeled fields, empty links/buttons, icon-only controls, iframes without title, tables without headers, heading-level skips, empty/dangling headings & labels, duplicate ids, invalid/broken ARIA, positive `tabindex`, autoplay/timed-refresh/`blink`/`marquee` media…
33
33
  - **Agent judgment (gated):** alt-text relevance, link purpose in context, reading/tab order, caption accuracy — the agent rules on these via `verify --manual` → `--apply`, each verdict carrying a justification (or a groundable NC), never a silent "conforming".
@@ -320,18 +320,18 @@ a test). See [`CONTRIBUTING.md`](CONTRIBUTING.md) and `skills/ultra11y/reference
320
320
 
321
321
  ### What RGAA automation actually covers
322
322
 
323
- The engine's 96 rules are not 96 RGAA criteria: several rules can evidence the same official
323
+ The engine's 97 rules are not 97 RGAA criteria: several rules can evidence the same official
324
324
  test, and a rule can detect a useful symptom without exhausting the criterion's alternatives,
325
325
  exceptions or relevance checks. The generated contract classifies all **258 official RGAA
326
326
  tests**:
327
327
 
328
- - **29 `static` tests across 21 criteria:** `1.1`, `2.1`, `5.7`, `5.8`, `6.1`, `6.2`, `7.1`,
328
+ - **30 `static` tests across 22 criteria:** `1.1`, `1.9`, `2.1`, `5.7`, `5.8`, `6.1`, `6.2`, `7.1`,
329
329
  `8.2`, `8.3`, `8.4`, `8.5`, `8.10`, `9.3`, `10.1`, `10.12`, `11.1`, `11.2`, `11.5`,
330
330
  `11.6`, `11.8`, `11.9`.
331
331
  - **3 `rendered` tests across 3 criteria:** `1.1`, `8.1`, `10.7`.
332
- - Those two tiers cover **23 distinct criteria that can produce a deterministic `NC`**;
332
+ - Those two tiers cover **24 distinct criteria that can produce a deterministic `NC`**;
333
333
  `1.1` belongs to both.
334
- - **52 criteria receive a normative engine signal:** 23 have at least one decisive rule and
334
+ - **53 criteria receive a normative engine signal:** 24 have at least one decisive rule and
335
335
  42 receive candidate evidence, with overlap. One additional criterion receives only an
336
336
  advisory signal. A candidate is forwarded to adjudication and never changes a verdict by
337
337
  itself.
@@ -342,7 +342,7 @@ tests**:
342
342
  glossary names five, and covers “presentation built out of spaces” with two heuristics —
343
343
  every one of them a deliberate under-report, which is the safe direction for a finding and
344
344
  the wrong one for a conformity.
345
- - The remaining **226 `judgment` tests across 92 criteria** all enter the AI worklist,
345
+ - The remaining **225 `judgment` tests across 92 criteria** all enter the AI worklist,
346
346
  including an apparently absent subject whose `NA` still needs confirmation. Overall,
347
347
  **104 of 106 criteria require adjudication to earn `C`**.
348
348
 
package/dist/cypress.mjs CHANGED
@@ -43,7 +43,26 @@ var COLLECT_MAX_ELEMENTS = 5e3;
43
43
  var COLLECT_SNAPSHOT = `(() => {
44
44
  const PROPS = ${JSON.stringify(COLLECTED_CSS)};
45
45
  const MAX = ${COLLECT_MAX_ELEMENTS};
46
- const els = document.querySelectorAll('*');
46
+ // The ordinal is a JOIN KEY against parseHtml(dom), so the walk must enumerate elements
47
+ // exactly as a reparse of the serialisation below will (#101). querySelectorAll('*') did not:
48
+ // - an element appended INSIDE a raw-text element (Next's dev overlay puts <nextjs-portal>
49
+ // in a <script>) is serialised as that element's raw text, and a reparse reads text \u2014
50
+ // one ordinal too many, and every digest refused from there on;
51
+ // - <template> contents are serialised and reparsed as elements, but live in
52
+ // template.content, which querySelectorAll never traverses \u2014 one ordinal too few.
53
+ // Pre-order, children of the raw-text elements HTML parsers (htmlparser2 included) treat as
54
+ // text skipped, template.content descended.
55
+ const RAW_TEXT = new Set(['script', 'style', 'title', 'textarea', 'xmp', 'iframe', 'noembed', 'noframes']);
56
+ const els = [];
57
+ const walkElements = (parent) => {
58
+ for (const child of parent.children) {
59
+ els.push(child);
60
+ const name = child.localName;
61
+ if (RAW_TEXT.has(name)) continue;
62
+ walkElements(name === 'template' && child.content ? child.content : child);
63
+ }
64
+ };
65
+ walkElements(document);
47
66
  const styles = [];
48
67
  const boxes = [];
49
68
  const n = Math.min(els.length, MAX);
@@ -48,7 +48,26 @@ var COLLECT_MAX_ELEMENTS = 5e3;
48
48
  var COLLECT_SNAPSHOT = `(() => {
49
49
  const PROPS = ${JSON.stringify(COLLECTED_CSS)};
50
50
  const MAX = ${COLLECT_MAX_ELEMENTS};
51
- const els = document.querySelectorAll('*');
51
+ // The ordinal is a JOIN KEY against parseHtml(dom), so the walk must enumerate elements
52
+ // exactly as a reparse of the serialisation below will (#101). querySelectorAll('*') did not:
53
+ // - an element appended INSIDE a raw-text element (Next's dev overlay puts <nextjs-portal>
54
+ // in a <script>) is serialised as that element's raw text, and a reparse reads text \u2014
55
+ // one ordinal too many, and every digest refused from there on;
56
+ // - <template> contents are serialised and reparsed as elements, but live in
57
+ // template.content, which querySelectorAll never traverses \u2014 one ordinal too few.
58
+ // Pre-order, children of the raw-text elements HTML parsers (htmlparser2 included) treat as
59
+ // text skipped, template.content descended.
60
+ const RAW_TEXT = new Set(['script', 'style', 'title', 'textarea', 'xmp', 'iframe', 'noembed', 'noframes']);
61
+ const els = [];
62
+ const walkElements = (parent) => {
63
+ for (const child of parent.children) {
64
+ els.push(child);
65
+ const name = child.localName;
66
+ if (RAW_TEXT.has(name)) continue;
67
+ walkElements(name === 'template' && child.content ? child.content : child);
68
+ }
69
+ };
70
+ walkElements(document);
52
71
  const styles = [];
53
72
  const boxes = [];
54
73
  const n = Math.min(els.length, MAX);
package/docker/runner.mjs CHANGED
@@ -3,7 +3,7 @@ import axe from "axe-core";
3
3
  const target = process.argv[2];
4
4
  const isFile = target.startsWith("/work/");
5
5
  const SNAPSHOT = process.env.ULTRA11Y_SNAPSHOT !== "0";
6
- const COLLECT = "(() => {\n const PROPS = [\"color\",\"backgroundColor\",\"backgroundImage\",\"fontSize\",\"fontWeight\",\"fontStyle\",\"textDecorationLine\",\"textTransform\",\"lineHeight\",\"letterSpacing\",\"wordSpacing\",\"whiteSpace\",\"display\",\"visibility\",\"opacity\",\"position\",\"overflowX\",\"overflowY\",\"outlineStyle\",\"outlineWidth\",\"outlineColor\",\"borderTopStyle\",\"borderRightStyle\",\"borderBottomStyle\",\"borderLeftStyle\",\"borderTopWidth\",\"borderRightWidth\",\"borderBottomWidth\",\"borderLeftWidth\",\"borderTopColor\",\"borderRightColor\",\"borderBottomColor\",\"borderLeftColor\",\"boxShadow\",\"cursor\"];\n const MAX = 5000;\n const els = document.querySelectorAll('*');\n const styles = [];\n const boxes = [];\n const n = Math.min(els.length, MAX);\n for (let i = 0; i < n; i++) {\n const el = els[i];\n const tag = el.tagName.toLowerCase();\n const cs = getComputedStyle(el);\n const css = {};\n for (const p of PROPS) {\n const v = cs[p];\n if (v !== undefined && v !== null && v !== '') css[p] = String(v);\n }\n styles.push({ i: i, tag: tag, css: css });\n const r = el.getBoundingClientRect();\n boxes.push({ i: i, tag: tag, x: Math.round(r.left), y: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height) });\n }\n // The page's own stylesheets. Some criteria are properties of the STYLESHEET rather than of\n // any element's computed style — focus styling removed with no replacement (2.4.7), a media\n // query that locks the orientation (1.3.4) — and this is the only place they exist.\n // A cross-origin sheet throws on .cssRules: COUNT those instead of ignoring them, so a rule\n // reading this digest can tell \"nothing there\" apart from \"I could not look\".\n // The cap is on the ORDINARY pool only, and the traversal never stops early.\n //\n // It used to return the moment the pool filled, which abandoned every remaining sheet —\n // and on a design-system app the pool fills long before the end. Measured on a real capture\n // of 38 pages: all 38 came back truncated, so rendered-focus-not-visible declined on every\n // one of them and 2.4.7 could never be decided by any number of scans. The rule was right to\n // decline (a :focus rule might have been among the dropped ones); the collector was wrong to\n // make that unavoidable.\n //\n // So the rules a rendered criterion actually READS — :focus styling, orientation locks,\n // pinned positioning, animation — are kept whatever the pool is doing, and truncated now\n // means \"some ordinary rule was dropped\", which is a much weaker statement. A rule can then\n // ask for what it needs instead of refusing on a cap that never concerned it.\n const cssRules = [];\n let unreadable = 0;\n let dropped = 0;\n const MAXR = 4000;\n const camel = (p) => p.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n const KEEP_SELECTOR = /:focus|:target|:active/i;\n const KEEP_PROP = /^(?:outline|position|animation|transition|transform)/;\n const walk = (list, media) => {\n for (const r of list) {\n if (typeof r.selectorText === 'string' && r.style) {\n const decls = {};\n for (let i = 0; i < r.style.length; i++) {\n const prop = r.style[i];\n decls[camel(prop)] = r.style.getPropertyValue(prop);\n }\n const keep = KEEP_SELECTOR.test(r.selectorText) || Object.keys(decls).some((k) => KEEP_PROP.test(k));\n if (cssRules.length >= MAXR && !keep) { dropped++; continue; }\n cssRules.push(media ? { selector: r.selectorText, media: media, decls: decls } : { selector: r.selectorText, decls: decls });\n } else if (r.cssRules) {\n const cond = r.conditionText || (r.media && r.media.mediaText) || media;\n walk(r.cssRules, cond);\n }\n }\n };\n for (const sheet of document.styleSheets) {\n try {\n walk(sheet.cssRules, undefined);\n } catch (e) {\n unreadable++;\n }\n }\n\n const truncated = els.length > MAX;\n return {\n dom: document.documentElement.outerHTML,\n css: { v: 1, rules: cssRules, unreadable: unreadable, truncated: dropped > 0, dropped: dropped },\n title: document.title,\n // The doctype is NOT part of documentElement.outerHTML, so a capture that records only\n // the DOM drops it — and RGAA 8.1 (is a doctype present, valid, and before <html>?) then\n // has nothing to look at. Recorded as its own field for that reason.\n doctype: document.doctype ? '<!DOCTYPE ' + document.doctype.name + (document.doctype.publicId ? ' PUBLIC \"' + document.doctype.publicId + '\"' : '') + (document.doctype.systemId ? ' \"' + document.doctype.systemId + '\"' : '') + '>' : '',\n lang: document.documentElement.getAttribute('lang') || '',\n url: location.href,\n viewport: { width: window.innerWidth, height: window.innerHeight },\n styles: { v: 1, entries: styles, truncated: truncated },\n boxes: { v: 1, entries: boxes, truncated: truncated }\n };\n})()";
6
+ const COLLECT = "(() => {\n const PROPS = [\"color\",\"backgroundColor\",\"backgroundImage\",\"fontSize\",\"fontWeight\",\"fontStyle\",\"textDecorationLine\",\"textTransform\",\"lineHeight\",\"letterSpacing\",\"wordSpacing\",\"whiteSpace\",\"display\",\"visibility\",\"opacity\",\"position\",\"overflowX\",\"overflowY\",\"outlineStyle\",\"outlineWidth\",\"outlineColor\",\"borderTopStyle\",\"borderRightStyle\",\"borderBottomStyle\",\"borderLeftStyle\",\"borderTopWidth\",\"borderRightWidth\",\"borderBottomWidth\",\"borderLeftWidth\",\"borderTopColor\",\"borderRightColor\",\"borderBottomColor\",\"borderLeftColor\",\"boxShadow\",\"cursor\"];\n const MAX = 5000;\n // The ordinal is a JOIN KEY against parseHtml(dom), so the walk must enumerate elements\n // exactly as a reparse of the serialisation below will (#101). querySelectorAll('*') did not:\n // - an element appended INSIDE a raw-text element (Next's dev overlay puts <nextjs-portal>\n // in a <script>) is serialised as that element's raw text, and a reparse reads text —\n // one ordinal too many, and every digest refused from there on;\n // - <template> contents are serialised and reparsed as elements, but live in\n // template.content, which querySelectorAll never traverses — one ordinal too few.\n // Pre-order, children of the raw-text elements HTML parsers (htmlparser2 included) treat as\n // text skipped, template.content descended.\n const RAW_TEXT = new Set(['script', 'style', 'title', 'textarea', 'xmp', 'iframe', 'noembed', 'noframes']);\n const els = [];\n const walkElements = (parent) => {\n for (const child of parent.children) {\n els.push(child);\n const name = child.localName;\n if (RAW_TEXT.has(name)) continue;\n walkElements(name === 'template' && child.content ? child.content : child);\n }\n };\n walkElements(document);\n const styles = [];\n const boxes = [];\n const n = Math.min(els.length, MAX);\n for (let i = 0; i < n; i++) {\n const el = els[i];\n const tag = el.tagName.toLowerCase();\n const cs = getComputedStyle(el);\n const css = {};\n for (const p of PROPS) {\n const v = cs[p];\n if (v !== undefined && v !== null && v !== '') css[p] = String(v);\n }\n styles.push({ i: i, tag: tag, css: css });\n const r = el.getBoundingClientRect();\n boxes.push({ i: i, tag: tag, x: Math.round(r.left), y: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height) });\n }\n // The page's own stylesheets. Some criteria are properties of the STYLESHEET rather than of\n // any element's computed style — focus styling removed with no replacement (2.4.7), a media\n // query that locks the orientation (1.3.4) — and this is the only place they exist.\n // A cross-origin sheet throws on .cssRules: COUNT those instead of ignoring them, so a rule\n // reading this digest can tell \"nothing there\" apart from \"I could not look\".\n // The cap is on the ORDINARY pool only, and the traversal never stops early.\n //\n // It used to return the moment the pool filled, which abandoned every remaining sheet —\n // and on a design-system app the pool fills long before the end. Measured on a real capture\n // of 38 pages: all 38 came back truncated, so rendered-focus-not-visible declined on every\n // one of them and 2.4.7 could never be decided by any number of scans. The rule was right to\n // decline (a :focus rule might have been among the dropped ones); the collector was wrong to\n // make that unavoidable.\n //\n // So the rules a rendered criterion actually READS — :focus styling, orientation locks,\n // pinned positioning, animation — are kept whatever the pool is doing, and truncated now\n // means \"some ordinary rule was dropped\", which is a much weaker statement. A rule can then\n // ask for what it needs instead of refusing on a cap that never concerned it.\n const cssRules = [];\n let unreadable = 0;\n let dropped = 0;\n const MAXR = 4000;\n const camel = (p) => p.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n const KEEP_SELECTOR = /:focus|:target|:active/i;\n const KEEP_PROP = /^(?:outline|position|animation|transition|transform)/;\n const walk = (list, media) => {\n for (const r of list) {\n if (typeof r.selectorText === 'string' && r.style) {\n const decls = {};\n for (let i = 0; i < r.style.length; i++) {\n const prop = r.style[i];\n decls[camel(prop)] = r.style.getPropertyValue(prop);\n }\n const keep = KEEP_SELECTOR.test(r.selectorText) || Object.keys(decls).some((k) => KEEP_PROP.test(k));\n if (cssRules.length >= MAXR && !keep) { dropped++; continue; }\n cssRules.push(media ? { selector: r.selectorText, media: media, decls: decls } : { selector: r.selectorText, decls: decls });\n } else if (r.cssRules) {\n const cond = r.conditionText || (r.media && r.media.mediaText) || media;\n walk(r.cssRules, cond);\n }\n }\n };\n for (const sheet of document.styleSheets) {\n try {\n walk(sheet.cssRules, undefined);\n } catch (e) {\n unreadable++;\n }\n }\n\n const truncated = els.length > MAX;\n return {\n dom: document.documentElement.outerHTML,\n css: { v: 1, rules: cssRules, unreadable: unreadable, truncated: dropped > 0, dropped: dropped },\n title: document.title,\n // The doctype is NOT part of documentElement.outerHTML, so a capture that records only\n // the DOM drops it — and RGAA 8.1 (is a doctype present, valid, and before <html>?) then\n // has nothing to look at. Recorded as its own field for that reason.\n doctype: document.doctype ? '<!DOCTYPE ' + document.doctype.name + (document.doctype.publicId ? ' PUBLIC \"' + document.doctype.publicId + '\"' : '') + (document.doctype.systemId ? ' \"' + document.doctype.systemId + '\"' : '') + '>' : '',\n lang: document.documentElement.getAttribute('lang') || '',\n url: location.href,\n viewport: { width: window.innerWidth, height: window.innerHeight },\n styles: { v: 1, entries: styles, truncated: truncated },\n boxes: { v: 1, entries: boxes, truncated: truncated }\n };\n})()";
7
7
  const browser = await chromium.launch({ args: ["--no-sandbox", "--disable-dev-shm-usage"] });
8
8
  try {
9
9
  const page = await browser.newPage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultra11y",
3
- "version": "5.54.0",
3
+ "version": "5.54.2",
4
4
  "description": "Audit d'accessibilité RGAA 4.1.2, le référentiel de l'État : rapport daté, grille des 106 critères, backlog et tickets. Moteur statique, navigateur et jugement IA contre-vérifié. Il ne déclare jamais conforme ce qu'il n'a pas vérifié. Socle WCAG 2.2 AA.",
5
5
  "homepage": "https://socialgouv.github.io/ultra11y/",
6
6
  "type": "module",
@@ -126,7 +126,7 @@ const bareSc = (w) => String(w).trim().split(/\s+/)[0];
126
126
  const RULE_SC = {
127
127
  "aria-hidden-focusable": ["4.1.2"], "aria-invalid-no-description": ["3.3.1"], "aria-ref-missing-id": ["4.1.2"],
128
128
  "aria-required-children": ["4.1.2"], "autoplay-media": ["1.4.2", "2.2.2"], "blink-marquee": ["2.2.2"],
129
- "button-empty-name": ["4.1.2"], "canvas-fallback-missing": ["1.1.1"], "chart-no-accessible-name": ["1.1.1"],
129
+ "button-empty-name": ["4.1.2"], "canvas-fallback-missing": ["1.1.1"], "chart-no-accessible-name": ["1.1.1"], "figure-caption-unassociated": ["1.1.1"],
130
130
  "clickable-noninteractive": ["4.1.2", "2.1.1"], "contrast-literal": ["1.4.3"], "control-label-missing": ["4.1.2"],
131
131
  "rendered-contrast": ["1.4.3"], "rendered-contrast-pixel": ["1.4.3"], "rendered-link-colour-only": ["1.4.1"],
132
132
  "rendered-nontext-contrast": ["1.4.11"], "rendered-focus-not-visible": ["2.4.7"], "rendered-orientation-lock": ["1.3.4"],
@@ -195,6 +195,9 @@ const RULE_TO_CRITERIA = {
195
195
  // Theme 1 — images (1.1 informative alt, 1.2 decorative)
196
196
  "img-alt-missing": ["1.1"], "input-image-alt-missing": ["1.1"], "object-embed-no-name": ["1.1"],
197
197
  "chart-no-accessible-name": ["1.1"], "canvas-fallback-missing": ["1.1"], "axe:image-alt": ["1.1"],
198
+ // RGAA 1.9.1: a captioned <figure> carries role="figure"|"group" and an aria-label identical to
199
+ // its <figcaption> (#97). Advisory in the WCAG core, re-normativized by `overrides` below.
200
+ "figure-caption-unassociated": ["1.9"],
198
201
  "axe:input-image-alt": ["1.1"], "axe:area-alt": ["1.1"], "axe:role-img-alt": ["1.1"], "axe:svg-img-alt": ["1.1"],
199
202
  "axe:object-alt": ["1.1"], "decorative-alt-misuse": ["1.2"], "axe:image-redundant-alt": ["1.2"],
200
203
  "decorative-marked-exposed": ["1.2"],
@@ -329,6 +332,7 @@ const RULE_TO_CRITERIA = {
329
332
  // `candidate` below. This deliberately small table contains only failures whose observation
330
333
  // itself exhausts the cited numbered test.
331
334
  const DECISIVE_RULE_TESTS = {
335
+ "1.9|figure-caption-unassociated": ["1"],
332
336
  "1.1|axe:area-alt": ["2"],
333
337
  "1.1|axe:input-image-alt": ["3"],
334
338
  "1.1|input-image-alt-missing": ["3"],
@@ -690,6 +694,8 @@ const DOWNLOAD_EXT = "pdf|docx?|pptx?|xlsx?|odt|ods|odp|rtf|csv|zip|rar|7z|gz|ep
690
694
  if (!presentational) throw new Error("build-pack-rgaa: RGAA 10.1 is missing from the referential");
691
695
  presentational.appliesTo = { ruleIds: [...new Set([...presentational.appliesTo.ruleIds, ...PRESENTATIONAL_RULE_IDS])].sort() };
692
696
  const overrides = Object.fromEntries(PRESENTATIONAL_RULE_IDS.map((id) => [id, { advisory: false, severity: "majeur" }]));
697
+ // Same reason, second use: WCAG never asks a <figure> for role + aria-label, RGAA 1.9.1 does.
698
+ overrides["figure-caption-unassociated"] = { advisory: false, severity: "majeur" };
693
699
 
694
700
  // ---- Test-level automation matrix -------------------------------------------------
695
701
  // Start fail-closed: every one of DINUM's 258 tests is a judgment until a rule is
@@ -639,7 +639,7 @@ const NEEDS_RENDERING = new Set([
639
639
  // icon-only-control-unnamed) appear under BOTH their SCs so registry's bidirectional
640
640
  // rule↔dataset cross-check holds.
641
641
  const RULE_SC_COVERAGE = {
642
- "1.1.1": ["img-alt-missing", "canvas-fallback-missing", "decorative-alt-misuse", "decorative-marked-exposed", "input-image-alt-missing", "object-embed-no-name", "chart-no-accessible-name"],
642
+ "1.1.1": ["img-alt-missing", "canvas-fallback-missing", "decorative-alt-misuse", "decorative-marked-exposed", "input-image-alt-missing", "object-embed-no-name", "chart-no-accessible-name", "figure-caption-unassociated"],
643
643
  "1.2.2": ["media-no-track"],
644
644
  "1.3.1": [
645
645
  "fieldset-legend-missing", "data-table-no-headers", "table-caption-missing",
@@ -6,7 +6,7 @@ import { join as join53, relative as relative6, resolve as resolve18, sep as sep
6
6
  import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL3 } from "url";
7
7
 
8
8
  // src/types.ts
9
- var VERSION = "5.54.0";
9
+ var VERSION = "5.54.2";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -131,7 +131,8 @@ var wcag_default = {
131
131
  "decorative-marked-exposed",
132
132
  "input-image-alt-missing",
133
133
  "object-embed-no-name",
134
- "chart-no-accessible-name"
134
+ "chart-no-accessible-name",
135
+ "figure-caption-unassociated"
135
136
  ],
136
137
  understanding: "https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html",
137
138
  techniques: [
@@ -38411,7 +38412,26 @@ var COLLECT_MAX_ELEMENTS = 5e3;
38411
38412
  var COLLECT_SNAPSHOT = `(() => {
38412
38413
  const PROPS = ${JSON.stringify(COLLECTED_CSS)};
38413
38414
  const MAX = ${COLLECT_MAX_ELEMENTS};
38414
- const els = document.querySelectorAll('*');
38415
+ // The ordinal is a JOIN KEY against parseHtml(dom), so the walk must enumerate elements
38416
+ // exactly as a reparse of the serialisation below will (#101). querySelectorAll('*') did not:
38417
+ // - an element appended INSIDE a raw-text element (Next's dev overlay puts <nextjs-portal>
38418
+ // in a <script>) is serialised as that element's raw text, and a reparse reads text \u2014
38419
+ // one ordinal too many, and every digest refused from there on;
38420
+ // - <template> contents are serialised and reparsed as elements, but live in
38421
+ // template.content, which querySelectorAll never traverses \u2014 one ordinal too few.
38422
+ // Pre-order, children of the raw-text elements HTML parsers (htmlparser2 included) treat as
38423
+ // text skipped, template.content descended.
38424
+ const RAW_TEXT = new Set(['script', 'style', 'title', 'textarea', 'xmp', 'iframe', 'noembed', 'noframes']);
38425
+ const els = [];
38426
+ const walkElements = (parent) => {
38427
+ for (const child of parent.children) {
38428
+ els.push(child);
38429
+ const name = child.localName;
38430
+ if (RAW_TEXT.has(name)) continue;
38431
+ walkElements(name === 'template' && child.content ? child.content : child);
38432
+ }
38433
+ };
38434
+ walkElements(document);
38415
38435
  const styles = [];
38416
38436
  const boxes = [];
38417
38437
  const n = Math.min(els.length, MAX);
@@ -39039,6 +39059,32 @@ var MSG_CATALOG = {
39039
39059
  en: () => `Add aria-label/title describing the content (and text fallback content inside <object>\u2026</object>), or aria-hidden="true" if decorative.`
39040
39060
  }
39041
39061
  },
39062
+ "figure-caption-unassociated": {
39063
+ message: {
39064
+ fr: (p) => {
39065
+ const m = String(p.missing).split(",");
39066
+ const parts2 = [
39067
+ m.includes("role") ? `pas de role="figure" ou "group"` : "",
39068
+ m.includes("aria-label") ? "pas d'aria-label" : "",
39069
+ m.includes("aria-label-mismatch") ? "un aria-label diff\xE9rent de la l\xE9gende" : ""
39070
+ ].filter(Boolean);
39071
+ return `<figure> l\xE9gend\xE9e (\xAB ${p.caption} \xBB) : ${parts2.join(", ")} \u2014 la l\xE9gende n'est pas reli\xE9e \xE0 l'image (test RGAA 1.9.1).`;
39072
+ },
39073
+ en: (p) => {
39074
+ const m = String(p.missing).split(",");
39075
+ const parts2 = [
39076
+ m.includes("role") ? `no role="figure" or "group"` : "",
39077
+ m.includes("aria-label") ? "no aria-label" : "",
39078
+ m.includes("aria-label-mismatch") ? "an aria-label that differs from the caption" : ""
39079
+ ].filter(Boolean);
39080
+ return `Captioned <figure> ("${p.caption}"): ${parts2.join(", ")} \u2014 the caption is not tied to the image.`;
39081
+ }
39082
+ },
39083
+ remediation: {
39084
+ fr: (p) => `Ajoutez role="figure" et aria-label="${p.caption}" sur la balise <figure>, identique au contenu du <figcaption>.`,
39085
+ en: (p) => `Add role="figure" and aria-label="${p.caption}" to the <figure>, identical to the <figcaption> content.`
39086
+ }
39087
+ },
39042
39088
  "chart-no-accessible-name": {
39043
39089
  message: {
39044
39090
  fr: (p) => `Graphique (<${p.tag}> ${p.cls}) sans nom accessible \u2014 alternative textuelle manquante.`,
@@ -40275,6 +40321,14 @@ function styleAt(doc, i2) {
40275
40321
  function hasDirectText(el) {
40276
40322
  return el.children.some((c2) => c2.type === "text" && c2.data.trim() !== "");
40277
40323
  }
40324
+ var DISABLEABLE = /* @__PURE__ */ new Set(["button", "input", "select", "textarea", "option", "optgroup", "fieldset"]);
40325
+ function inactive(el) {
40326
+ for (let n = el; n; n = n.parent) {
40327
+ if (attr(n, "aria-disabled") === "true") return true;
40328
+ if (DISABLEABLE.has(n.tag) && attr(n, "disabled") !== void 0) return true;
40329
+ }
40330
+ return false;
40331
+ }
40278
40332
  function invisible(css) {
40279
40333
  if (css.display === "none" || css.visibility === "hidden") return true;
40280
40334
  const op = Number.parseFloat(css.opacity ?? "1");
@@ -40330,7 +40384,7 @@ var renderedContrast = {
40330
40384
  const index = elementIndex(doc);
40331
40385
  const out2 = [];
40332
40386
  for (const [el, i2] of index) {
40333
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
40387
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
40334
40388
  const css = styleAt(doc, i2)?.css;
40335
40389
  if (!css || invisible(css)) continue;
40336
40390
  const fg = parseColor(css.color ?? "");
@@ -40369,7 +40423,7 @@ var renderedContrastPixel = {
40369
40423
  const index = elementIndex(doc);
40370
40424
  const out2 = [];
40371
40425
  for (const [el, i2] of index) {
40372
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
40426
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
40373
40427
  const css = styleAt(doc, i2)?.css;
40374
40428
  if (!css || invisible(css)) continue;
40375
40429
  if (backdropOf(doc, index, el)) continue;
@@ -40399,12 +40453,24 @@ function hasNonColourAffordance(css, parentCss) {
40399
40453
  if ((css.borderBottomStyle ?? "none") !== "none" && Number.parseFloat(css.borderBottomWidth ?? "0") > 0) return true;
40400
40454
  const bg = parseColor(css.backgroundColor ?? "");
40401
40455
  if (bg && bg.a > 0) return true;
40456
+ if ((css.backgroundImage ?? "none") !== "none") return true;
40457
+ if ((css.boxShadow ?? "none") !== "none") return true;
40402
40458
  const w = Number.parseInt(css.fontWeight ?? "400", 10);
40403
40459
  const pw = Number.parseInt(parentCss?.fontWeight ?? "400", 10);
40404
40460
  if (Number.isFinite(w) && Number.isFinite(pw) && w >= pw + 200) return true;
40405
40461
  return false;
40406
40462
  }
40407
40463
  var TEXT_BLOCK = /* @__PURE__ */ new Set(["p", "li", "dd", "dt", "td", "th", "blockquote", "figcaption", "caption"]);
40464
+ var WORD = /[\p{L}\p{N}]/u;
40465
+ function hasSurroundingText(block, link) {
40466
+ for (const c2 of block.children) {
40467
+ if (c2 === link) continue;
40468
+ if (c2.type === "text") {
40469
+ if (WORD.test(c2.data)) return true;
40470
+ } else if (WORD.test(visibleText(c2))) return true;
40471
+ }
40472
+ return false;
40473
+ }
40408
40474
  var renderedLinkColourOnly = {
40409
40475
  id: "rendered-link-colour-only",
40410
40476
  criteria: ["1.4.1"],
@@ -40417,6 +40483,7 @@ var renderedLinkColourOnly = {
40417
40483
  if (el.tag !== "a" || !hasDirectText(el)) continue;
40418
40484
  const parent = el.parent;
40419
40485
  if (!parent || !TEXT_BLOCK.has(parent.tag)) continue;
40486
+ if (!hasSurroundingText(parent, el)) continue;
40420
40487
  const css = styleAt(doc, i2)?.css;
40421
40488
  const pi = index.get(parent);
40422
40489
  const parentCss = pi === void 0 ? void 0 : styleAt(doc, pi)?.css;
@@ -40459,9 +40526,11 @@ var renderedNonTextContrast = {
40459
40526
  const index = elementIndex(doc);
40460
40527
  const out2 = [];
40461
40528
  for (const [el, i2] of index) {
40462
- if (!BOUNDED_CONTROLS.has(el.tag)) continue;
40529
+ if (!BOUNDED_CONTROLS.has(el.tag) || inactive(el)) continue;
40463
40530
  const type = (el.attribs.type ?? "").toLowerCase();
40464
40531
  if (el.tag === "input" && (type === "hidden" || type === "image")) continue;
40532
+ if (el.tag === "button" && WORD.test(visibleText(el))) continue;
40533
+ if (el.tag === "input" && ["button", "submit", "reset"].includes(type) && WORD.test(el.attribs.value ?? "")) continue;
40465
40534
  const css = styleAt(doc, i2)?.css;
40466
40535
  if (!css || invisible(css)) continue;
40467
40536
  if (css.boxShadow && css.boxShadow !== "none") continue;
@@ -41082,6 +41151,10 @@ var rgaa_default = {
41082
41151
  "presentational-spacing": {
41083
41152
  advisory: false,
41084
41153
  severity: "majeur"
41154
+ },
41155
+ "figure-caption-unassociated": {
41156
+ advisory: false,
41157
+ severity: "majeur"
41085
41158
  }
41086
41159
  },
41087
41160
  themes: [
@@ -41960,17 +42033,24 @@ var rgaa_default = {
41960
42033
  ],
41961
42034
  wcag: ["1.1.1", "4.1.2"],
41962
42035
  appliesTo: {
41963
- ruleIds: []
42036
+ ruleIds: ["figure-caption-unassociated"]
41964
42037
  },
41965
42038
  automation: {
41966
42039
  tests: {
41967
- "1": "judgment",
42040
+ "1": "static",
41968
42041
  "2": "judgment",
41969
42042
  "3": "judgment",
41970
42043
  "4": "judgment",
41971
42044
  "5": "judgment"
41972
42045
  },
41973
- rules: []
42046
+ rules: [
42047
+ {
42048
+ id: "figure-caption-unassociated",
42049
+ tests: ["1"],
42050
+ effect: "decisive-nc",
42051
+ rationale: "The observed failure exhausts the cited RGAA test."
42052
+ }
42053
+ ]
41974
42054
  }
41975
42055
  },
41976
42056
  {
@@ -49754,11 +49834,11 @@ function isHiddenFromAT(el) {
49754
49834
  return [el, ...ancestors(el)].some((node) => attr(node, "aria-hidden") === "true");
49755
49835
  }
49756
49836
  var NATIVE_FOCUSABLE = /* @__PURE__ */ new Set(["button", "select", "textarea", "iframe", "summary"]);
49757
- var DISABLEABLE = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
49837
+ var DISABLEABLE2 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
49758
49838
  function isFocusableElement(el) {
49759
49839
  const ti = attr(el, "tabindex");
49760
49840
  if (ti !== void 0 && !ti.includes("{") && ti.trim() !== "" && !Number.isNaN(Number(ti.trim()))) return true;
49761
- if (DISABLEABLE.has(el.tag) && hasAttr(el, "disabled")) return false;
49841
+ if (DISABLEABLE2.has(el.tag) && hasAttr(el, "disabled")) return false;
49762
49842
  if (NATIVE_FOCUSABLE.has(el.tag)) return true;
49763
49843
  if (el.tag === "a" || el.tag === "area") return hasAttr(el, "href");
49764
49844
  if (el.tag === "input") return (attr(el, "type") ?? "text").trim().toLowerCase() !== "hidden";
@@ -50101,7 +50181,46 @@ var chartNoAccessibleName = {
50101
50181
  return out2;
50102
50182
  }
50103
50183
  };
50104
- var imagesRules = [imgAltMissing, decorativeAltMisuse, canvasFallbackMissing, inputImageAltMissing, objectEmbedNoName, chartNoAccessibleName];
50184
+ var FIGURE_ROLES = /* @__PURE__ */ new Set(["figure", "group"]);
50185
+ var collapseWs = (s) => s.replace(/\s+/g, " ").trim();
50186
+ var frameworkBound = (el, name2) => [":", "v-bind:", "x-bind:", "bind:"].some((p) => `${p}${name2}` in el.attribs);
50187
+ var isCaptionedImage = (d) => d.tag === "img" || d.tag === "input" && (attr(d, "type") ?? "").trim().toLowerCase() === "image" || (attr(d, "role") ?? "").trim().toLowerCase() === "img";
50188
+ var figureCaptionUnassociated = {
50189
+ id: "figure-caption-unassociated",
50190
+ criteria: ["1.1.1"],
50191
+ severity: "majeur",
50192
+ advisory: true,
50193
+ run(doc) {
50194
+ const out2 = [];
50195
+ for (const el of doc.elements) {
50196
+ if (el.tag !== "figure" || isHidden(el) || hasDynamicSpread(el)) continue;
50197
+ const desc = descendants(el);
50198
+ const caption = desc.find((d) => d.tag === "figcaption");
50199
+ if (!caption || !desc.some((d) => d !== caption && isCaptionedImage(d) && !ancestors(d).includes(caption))) continue;
50200
+ const captionText = collapseWs(textContent(caption));
50201
+ if (!captionText || captionText.includes("{") || mayInjectContent(caption)) continue;
50202
+ const role = attr(el, "role");
50203
+ const label = attr(el, "aria-label");
50204
+ if ((role ?? "").includes("{") || (label ?? "").includes("{") || frameworkBound(el, "role") || frameworkBound(el, "aria-label")) continue;
50205
+ const missing = [];
50206
+ if (!FIGURE_ROLES.has((role ?? "").trim().toLowerCase())) missing.push("role");
50207
+ if (label === void 0 || !label.trim()) missing.push("aria-label");
50208
+ else if (collapseWs(label) !== captionText) missing.push("aria-label-mismatch");
50209
+ if (!missing.length) continue;
50210
+ out2.push({ criteriaId: "1.1.1", el, msgId: "figure-caption-unassociated", params: { caption: captionText, missing: missing.join(",") } });
50211
+ }
50212
+ return out2;
50213
+ }
50214
+ };
50215
+ var imagesRules = [
50216
+ figureCaptionUnassociated,
50217
+ imgAltMissing,
50218
+ decorativeAltMisuse,
50219
+ canvasFallbackMissing,
50220
+ inputImageAltMissing,
50221
+ objectEmbedNoName,
50222
+ chartNoAccessibleName
50223
+ ];
50105
50224
 
50106
50225
  // src/rules/frames.ts
50107
50226
  var iframeTitleMissing = {
@@ -50341,8 +50460,8 @@ function isInteractive(el) {
50341
50460
  if (el.tag === "input") return (attr(el, "type") ?? "text").toLowerCase() !== "hidden";
50342
50461
  return INTERACTIVE_ROLES.includes((attr(el, "role") ?? "").trim());
50343
50462
  }
50344
- var DISABLEABLE2 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea", "fieldset", "optgroup", "option"]);
50345
- var isDisabled = (el) => DISABLEABLE2.has(el.tag) && hasAttr(el, "disabled");
50463
+ var DISABLEABLE3 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea", "fieldset", "optgroup", "option"]);
50464
+ var isDisabled = (el) => DISABLEABLE3.has(el.tag) && hasAttr(el, "disabled");
50346
50465
  function isFocusable(el) {
50347
50466
  const tiRaw = attr(el, "tabindex");
50348
50467
  if (tiRaw !== void 0) {
@@ -3,7 +3,7 @@ name: review-a11y
3
3
  description: "Use to REVIEW changed frontend code for accessibility: staged files, a working diff, branch, or PR; prompts such as 'review a11y', 'is this accessible?', or 'anything to fix before merge?'; and hook or CI findings on a change. Run the bundled install-free engine with cross-file JSX/TSX analysis, then adjudicate candidates and return a severity-ranked WCAG 2.2 AA review with file:line fixes, residual rendering risks, and a verdict. Use `ultra11y` instead for whole-repo audits, dated conformance reports, country standards, PRD backlogs, or authoring accessible markup."
4
4
  license: MIT
5
5
  metadata:
6
- version: 5.54.0
6
+ version: 5.54.2
7
7
  ---
8
8
 
9
9
  # review-a11y — accessibility review of changed code