ultra11y 5.54.1 → 5.54.3

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.1",
13
+ "version": "5.54.3",
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.1",
4
+ "version": "5.54.3",
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.1",
4
+ "version": "5.54.3",
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.1";
30
+ const ULTRA11Y_PLUGIN_VERSION = "5.54.3";
31
31
 
32
32
  const here = dirname(fileURLToPath(import.meta.url));
33
33
 
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.1",
3
+ "version": "5.54.3",
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",
@@ -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.1";
9
+ var VERSION = "5.54.3";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -38412,7 +38412,26 @@ var COLLECT_MAX_ELEMENTS = 5e3;
38412
38412
  var COLLECT_SNAPSHOT = `(() => {
38413
38413
  const PROPS = ${JSON.stringify(COLLECTED_CSS)};
38414
38414
  const MAX = ${COLLECT_MAX_ELEMENTS};
38415
- 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);
38416
38435
  const styles = [];
38417
38436
  const boxes = [];
38418
38437
  const n = Math.min(els.length, MAX);
@@ -40302,6 +40321,14 @@ function styleAt(doc, i2) {
40302
40321
  function hasDirectText(el) {
40303
40322
  return el.children.some((c2) => c2.type === "text" && c2.data.trim() !== "");
40304
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
+ }
40305
40332
  function invisible(css) {
40306
40333
  if (css.display === "none" || css.visibility === "hidden") return true;
40307
40334
  const op = Number.parseFloat(css.opacity ?? "1");
@@ -40357,7 +40384,7 @@ var renderedContrast = {
40357
40384
  const index = elementIndex(doc);
40358
40385
  const out2 = [];
40359
40386
  for (const [el, i2] of index) {
40360
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
40387
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
40361
40388
  const css = styleAt(doc, i2)?.css;
40362
40389
  if (!css || invisible(css)) continue;
40363
40390
  const fg = parseColor(css.color ?? "");
@@ -40396,7 +40423,7 @@ var renderedContrastPixel = {
40396
40423
  const index = elementIndex(doc);
40397
40424
  const out2 = [];
40398
40425
  for (const [el, i2] of index) {
40399
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
40426
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
40400
40427
  const css = styleAt(doc, i2)?.css;
40401
40428
  if (!css || invisible(css)) continue;
40402
40429
  if (backdropOf(doc, index, el)) continue;
@@ -40426,12 +40453,24 @@ function hasNonColourAffordance(css, parentCss) {
40426
40453
  if ((css.borderBottomStyle ?? "none") !== "none" && Number.parseFloat(css.borderBottomWidth ?? "0") > 0) return true;
40427
40454
  const bg = parseColor(css.backgroundColor ?? "");
40428
40455
  if (bg && bg.a > 0) return true;
40456
+ if ((css.backgroundImage ?? "none") !== "none") return true;
40457
+ if ((css.boxShadow ?? "none") !== "none") return true;
40429
40458
  const w = Number.parseInt(css.fontWeight ?? "400", 10);
40430
40459
  const pw = Number.parseInt(parentCss?.fontWeight ?? "400", 10);
40431
40460
  if (Number.isFinite(w) && Number.isFinite(pw) && w >= pw + 200) return true;
40432
40461
  return false;
40433
40462
  }
40434
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
+ }
40435
40474
  var renderedLinkColourOnly = {
40436
40475
  id: "rendered-link-colour-only",
40437
40476
  criteria: ["1.4.1"],
@@ -40444,6 +40483,7 @@ var renderedLinkColourOnly = {
40444
40483
  if (el.tag !== "a" || !hasDirectText(el)) continue;
40445
40484
  const parent = el.parent;
40446
40485
  if (!parent || !TEXT_BLOCK.has(parent.tag)) continue;
40486
+ if (!hasSurroundingText(parent, el)) continue;
40447
40487
  const css = styleAt(doc, i2)?.css;
40448
40488
  const pi = index.get(parent);
40449
40489
  const parentCss = pi === void 0 ? void 0 : styleAt(doc, pi)?.css;
@@ -40486,9 +40526,11 @@ var renderedNonTextContrast = {
40486
40526
  const index = elementIndex(doc);
40487
40527
  const out2 = [];
40488
40528
  for (const [el, i2] of index) {
40489
- if (!BOUNDED_CONTROLS.has(el.tag)) continue;
40529
+ if (!BOUNDED_CONTROLS.has(el.tag) || inactive(el)) continue;
40490
40530
  const type = (el.attribs.type ?? "").toLowerCase();
40491
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;
40492
40534
  const css = styleAt(doc, i2)?.css;
40493
40535
  if (!css || invisible(css)) continue;
40494
40536
  if (css.boxShadow && css.boxShadow !== "none") continue;
@@ -49792,11 +49834,11 @@ function isHiddenFromAT(el) {
49792
49834
  return [el, ...ancestors(el)].some((node) => attr(node, "aria-hidden") === "true");
49793
49835
  }
49794
49836
  var NATIVE_FOCUSABLE = /* @__PURE__ */ new Set(["button", "select", "textarea", "iframe", "summary"]);
49795
- var DISABLEABLE = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
49837
+ var DISABLEABLE2 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
49796
49838
  function isFocusableElement(el) {
49797
49839
  const ti = attr(el, "tabindex");
49798
49840
  if (ti !== void 0 && !ti.includes("{") && ti.trim() !== "" && !Number.isNaN(Number(ti.trim()))) return true;
49799
- if (DISABLEABLE.has(el.tag) && hasAttr(el, "disabled")) return false;
49841
+ if (DISABLEABLE2.has(el.tag) && hasAttr(el, "disabled")) return false;
49800
49842
  if (NATIVE_FOCUSABLE.has(el.tag)) return true;
49801
49843
  if (el.tag === "a" || el.tag === "area") return hasAttr(el, "href");
49802
49844
  if (el.tag === "input") return (attr(el, "type") ?? "text").trim().toLowerCase() !== "hidden";
@@ -50418,8 +50460,8 @@ function isInteractive(el) {
50418
50460
  if (el.tag === "input") return (attr(el, "type") ?? "text").toLowerCase() !== "hidden";
50419
50461
  return INTERACTIVE_ROLES.includes((attr(el, "role") ?? "").trim());
50420
50462
  }
50421
- var DISABLEABLE2 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea", "fieldset", "optgroup", "option"]);
50422
- 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");
50423
50465
  function isFocusable(el) {
50424
50466
  const tiRaw = attr(el, "tabindex");
50425
50467
  if (tiRaw !== void 0) {
@@ -51527,6 +51569,9 @@ var listStructure = {
51527
51569
  const parent = el.parent;
51528
51570
  if (!parent || ["ul", "ol", "menu"].includes(parent.tag)) continue;
51529
51571
  if (parent.tag === "template" || ancestors(el).some((a) => a.tag === "template" || a.tag !== "#fragment" && rendersElsewhere(a.tag))) continue;
51572
+ let host = parent;
51573
+ while (host && host.tag === "#fragment") host = host.parent;
51574
+ if (!host) continue;
51530
51575
  out2.push({
51531
51576
  criteriaId: "1.3.1",
51532
51577
  el,
@@ -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.1
6
+ version: 5.54.3
7
7
  ---
8
8
 
9
9
  # review-a11y — accessibility review of changed code
@@ -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.1";
9
+ var VERSION = "5.54.3";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -38412,7 +38412,26 @@ var COLLECT_MAX_ELEMENTS = 5e3;
38412
38412
  var COLLECT_SNAPSHOT = `(() => {
38413
38413
  const PROPS = ${JSON.stringify(COLLECTED_CSS)};
38414
38414
  const MAX = ${COLLECT_MAX_ELEMENTS};
38415
- 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);
38416
38435
  const styles = [];
38417
38436
  const boxes = [];
38418
38437
  const n = Math.min(els.length, MAX);
@@ -40302,6 +40321,14 @@ function styleAt(doc, i2) {
40302
40321
  function hasDirectText(el) {
40303
40322
  return el.children.some((c2) => c2.type === "text" && c2.data.trim() !== "");
40304
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
+ }
40305
40332
  function invisible(css) {
40306
40333
  if (css.display === "none" || css.visibility === "hidden") return true;
40307
40334
  const op = Number.parseFloat(css.opacity ?? "1");
@@ -40357,7 +40384,7 @@ var renderedContrast = {
40357
40384
  const index = elementIndex(doc);
40358
40385
  const out2 = [];
40359
40386
  for (const [el, i2] of index) {
40360
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
40387
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
40361
40388
  const css = styleAt(doc, i2)?.css;
40362
40389
  if (!css || invisible(css)) continue;
40363
40390
  const fg = parseColor(css.color ?? "");
@@ -40396,7 +40423,7 @@ var renderedContrastPixel = {
40396
40423
  const index = elementIndex(doc);
40397
40424
  const out2 = [];
40398
40425
  for (const [el, i2] of index) {
40399
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
40426
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
40400
40427
  const css = styleAt(doc, i2)?.css;
40401
40428
  if (!css || invisible(css)) continue;
40402
40429
  if (backdropOf(doc, index, el)) continue;
@@ -40426,12 +40453,24 @@ function hasNonColourAffordance(css, parentCss) {
40426
40453
  if ((css.borderBottomStyle ?? "none") !== "none" && Number.parseFloat(css.borderBottomWidth ?? "0") > 0) return true;
40427
40454
  const bg = parseColor(css.backgroundColor ?? "");
40428
40455
  if (bg && bg.a > 0) return true;
40456
+ if ((css.backgroundImage ?? "none") !== "none") return true;
40457
+ if ((css.boxShadow ?? "none") !== "none") return true;
40429
40458
  const w = Number.parseInt(css.fontWeight ?? "400", 10);
40430
40459
  const pw = Number.parseInt(parentCss?.fontWeight ?? "400", 10);
40431
40460
  if (Number.isFinite(w) && Number.isFinite(pw) && w >= pw + 200) return true;
40432
40461
  return false;
40433
40462
  }
40434
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
+ }
40435
40474
  var renderedLinkColourOnly = {
40436
40475
  id: "rendered-link-colour-only",
40437
40476
  criteria: ["1.4.1"],
@@ -40444,6 +40483,7 @@ var renderedLinkColourOnly = {
40444
40483
  if (el.tag !== "a" || !hasDirectText(el)) continue;
40445
40484
  const parent = el.parent;
40446
40485
  if (!parent || !TEXT_BLOCK.has(parent.tag)) continue;
40486
+ if (!hasSurroundingText(parent, el)) continue;
40447
40487
  const css = styleAt(doc, i2)?.css;
40448
40488
  const pi = index.get(parent);
40449
40489
  const parentCss = pi === void 0 ? void 0 : styleAt(doc, pi)?.css;
@@ -40486,9 +40526,11 @@ var renderedNonTextContrast = {
40486
40526
  const index = elementIndex(doc);
40487
40527
  const out2 = [];
40488
40528
  for (const [el, i2] of index) {
40489
- if (!BOUNDED_CONTROLS.has(el.tag)) continue;
40529
+ if (!BOUNDED_CONTROLS.has(el.tag) || inactive(el)) continue;
40490
40530
  const type = (el.attribs.type ?? "").toLowerCase();
40491
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;
40492
40534
  const css = styleAt(doc, i2)?.css;
40493
40535
  if (!css || invisible(css)) continue;
40494
40536
  if (css.boxShadow && css.boxShadow !== "none") continue;
@@ -49792,11 +49834,11 @@ function isHiddenFromAT(el) {
49792
49834
  return [el, ...ancestors(el)].some((node) => attr(node, "aria-hidden") === "true");
49793
49835
  }
49794
49836
  var NATIVE_FOCUSABLE = /* @__PURE__ */ new Set(["button", "select", "textarea", "iframe", "summary"]);
49795
- var DISABLEABLE = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
49837
+ var DISABLEABLE2 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
49796
49838
  function isFocusableElement(el) {
49797
49839
  const ti = attr(el, "tabindex");
49798
49840
  if (ti !== void 0 && !ti.includes("{") && ti.trim() !== "" && !Number.isNaN(Number(ti.trim()))) return true;
49799
- if (DISABLEABLE.has(el.tag) && hasAttr(el, "disabled")) return false;
49841
+ if (DISABLEABLE2.has(el.tag) && hasAttr(el, "disabled")) return false;
49800
49842
  if (NATIVE_FOCUSABLE.has(el.tag)) return true;
49801
49843
  if (el.tag === "a" || el.tag === "area") return hasAttr(el, "href");
49802
49844
  if (el.tag === "input") return (attr(el, "type") ?? "text").trim().toLowerCase() !== "hidden";
@@ -50418,8 +50460,8 @@ function isInteractive(el) {
50418
50460
  if (el.tag === "input") return (attr(el, "type") ?? "text").toLowerCase() !== "hidden";
50419
50461
  return INTERACTIVE_ROLES.includes((attr(el, "role") ?? "").trim());
50420
50462
  }
50421
- var DISABLEABLE2 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea", "fieldset", "optgroup", "option"]);
50422
- 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");
50423
50465
  function isFocusable(el) {
50424
50466
  const tiRaw = attr(el, "tabindex");
50425
50467
  if (tiRaw !== void 0) {
@@ -51527,6 +51569,9 @@ var listStructure = {
51527
51569
  const parent = el.parent;
51528
51570
  if (!parent || ["ul", "ol", "menu"].includes(parent.tag)) continue;
51529
51571
  if (parent.tag === "template" || ancestors(el).some((a) => a.tag === "template" || a.tag !== "#fragment" && rendersElsewhere(a.tag))) continue;
51572
+ let host = parent;
51573
+ while (host && host.tag === "#fragment") host = host.parent;
51574
+ if (!host) continue;
51530
51575
  out2.push({
51531
51576
  criteriaId: "1.3.1",
51532
51577
  el,
@@ -3,7 +3,7 @@ name: ultra11y
3
3
  description: "Use to AUDIT a site, repository, or page against RGAA 4.1.2, the French State's accessibility standard (référentiel de l'État), on a WCAG 2.2 AA core (other country standards as packs); produce a dated conformance report, criterion grid, PRD backlog, or tickets; AUTHOR accessible markup; fix accessibility; or wire a repo gate and rendered-DOM capture pipeline. The bundled install-free engine runs 97 static checks tied to success criteria, while the agent adjudicates judgment criteria and routes rendering criteria to browser scans; check/verify reject invented non-conformities and never declare conforming what was not verified. Use `review-a11y` instead for a review scoped only to a diff, branch, or PR."
4
4
  license: MIT
5
5
  metadata:
6
- version: 5.54.1
6
+ version: 5.54.3
7
7
  ---
8
8
 
9
9
  # ultra11y — audit WCAG 2.2 AA and write accessible markup
@@ -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.1";
9
+ var VERSION = "5.54.3";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -38412,7 +38412,26 @@ var COLLECT_MAX_ELEMENTS = 5e3;
38412
38412
  var COLLECT_SNAPSHOT = `(() => {
38413
38413
  const PROPS = ${JSON.stringify(COLLECTED_CSS)};
38414
38414
  const MAX = ${COLLECT_MAX_ELEMENTS};
38415
- 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);
38416
38435
  const styles = [];
38417
38436
  const boxes = [];
38418
38437
  const n = Math.min(els.length, MAX);
@@ -40302,6 +40321,14 @@ function styleAt(doc, i2) {
40302
40321
  function hasDirectText(el) {
40303
40322
  return el.children.some((c2) => c2.type === "text" && c2.data.trim() !== "");
40304
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
+ }
40305
40332
  function invisible(css) {
40306
40333
  if (css.display === "none" || css.visibility === "hidden") return true;
40307
40334
  const op = Number.parseFloat(css.opacity ?? "1");
@@ -40357,7 +40384,7 @@ var renderedContrast = {
40357
40384
  const index = elementIndex(doc);
40358
40385
  const out2 = [];
40359
40386
  for (const [el, i2] of index) {
40360
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
40387
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
40361
40388
  const css = styleAt(doc, i2)?.css;
40362
40389
  if (!css || invisible(css)) continue;
40363
40390
  const fg = parseColor(css.color ?? "");
@@ -40396,7 +40423,7 @@ var renderedContrastPixel = {
40396
40423
  const index = elementIndex(doc);
40397
40424
  const out2 = [];
40398
40425
  for (const [el, i2] of index) {
40399
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
40426
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
40400
40427
  const css = styleAt(doc, i2)?.css;
40401
40428
  if (!css || invisible(css)) continue;
40402
40429
  if (backdropOf(doc, index, el)) continue;
@@ -40426,12 +40453,24 @@ function hasNonColourAffordance(css, parentCss) {
40426
40453
  if ((css.borderBottomStyle ?? "none") !== "none" && Number.parseFloat(css.borderBottomWidth ?? "0") > 0) return true;
40427
40454
  const bg = parseColor(css.backgroundColor ?? "");
40428
40455
  if (bg && bg.a > 0) return true;
40456
+ if ((css.backgroundImage ?? "none") !== "none") return true;
40457
+ if ((css.boxShadow ?? "none") !== "none") return true;
40429
40458
  const w = Number.parseInt(css.fontWeight ?? "400", 10);
40430
40459
  const pw = Number.parseInt(parentCss?.fontWeight ?? "400", 10);
40431
40460
  if (Number.isFinite(w) && Number.isFinite(pw) && w >= pw + 200) return true;
40432
40461
  return false;
40433
40462
  }
40434
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
+ }
40435
40474
  var renderedLinkColourOnly = {
40436
40475
  id: "rendered-link-colour-only",
40437
40476
  criteria: ["1.4.1"],
@@ -40444,6 +40483,7 @@ var renderedLinkColourOnly = {
40444
40483
  if (el.tag !== "a" || !hasDirectText(el)) continue;
40445
40484
  const parent = el.parent;
40446
40485
  if (!parent || !TEXT_BLOCK.has(parent.tag)) continue;
40486
+ if (!hasSurroundingText(parent, el)) continue;
40447
40487
  const css = styleAt(doc, i2)?.css;
40448
40488
  const pi = index.get(parent);
40449
40489
  const parentCss = pi === void 0 ? void 0 : styleAt(doc, pi)?.css;
@@ -40486,9 +40526,11 @@ var renderedNonTextContrast = {
40486
40526
  const index = elementIndex(doc);
40487
40527
  const out2 = [];
40488
40528
  for (const [el, i2] of index) {
40489
- if (!BOUNDED_CONTROLS.has(el.tag)) continue;
40529
+ if (!BOUNDED_CONTROLS.has(el.tag) || inactive(el)) continue;
40490
40530
  const type = (el.attribs.type ?? "").toLowerCase();
40491
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;
40492
40534
  const css = styleAt(doc, i2)?.css;
40493
40535
  if (!css || invisible(css)) continue;
40494
40536
  if (css.boxShadow && css.boxShadow !== "none") continue;
@@ -49792,11 +49834,11 @@ function isHiddenFromAT(el) {
49792
49834
  return [el, ...ancestors(el)].some((node) => attr(node, "aria-hidden") === "true");
49793
49835
  }
49794
49836
  var NATIVE_FOCUSABLE = /* @__PURE__ */ new Set(["button", "select", "textarea", "iframe", "summary"]);
49795
- var DISABLEABLE = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
49837
+ var DISABLEABLE2 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
49796
49838
  function isFocusableElement(el) {
49797
49839
  const ti = attr(el, "tabindex");
49798
49840
  if (ti !== void 0 && !ti.includes("{") && ti.trim() !== "" && !Number.isNaN(Number(ti.trim()))) return true;
49799
- if (DISABLEABLE.has(el.tag) && hasAttr(el, "disabled")) return false;
49841
+ if (DISABLEABLE2.has(el.tag) && hasAttr(el, "disabled")) return false;
49800
49842
  if (NATIVE_FOCUSABLE.has(el.tag)) return true;
49801
49843
  if (el.tag === "a" || el.tag === "area") return hasAttr(el, "href");
49802
49844
  if (el.tag === "input") return (attr(el, "type") ?? "text").trim().toLowerCase() !== "hidden";
@@ -50418,8 +50460,8 @@ function isInteractive(el) {
50418
50460
  if (el.tag === "input") return (attr(el, "type") ?? "text").toLowerCase() !== "hidden";
50419
50461
  return INTERACTIVE_ROLES.includes((attr(el, "role") ?? "").trim());
50420
50462
  }
50421
- var DISABLEABLE2 = /* @__PURE__ */ new Set(["button", "input", "select", "textarea", "fieldset", "optgroup", "option"]);
50422
- 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");
50423
50465
  function isFocusable(el) {
50424
50466
  const tiRaw = attr(el, "tabindex");
50425
50467
  if (tiRaw !== void 0) {
@@ -51527,6 +51569,9 @@ var listStructure = {
51527
51569
  const parent = el.parent;
51528
51570
  if (!parent || ["ul", "ol", "menu"].includes(parent.tag)) continue;
51529
51571
  if (parent.tag === "template" || ancestors(el).some((a) => a.tag === "template" || a.tag !== "#fragment" && rendersElsewhere(a.tag))) continue;
51572
+ let host = parent;
51573
+ while (host && host.tag === "#fragment") host = host.parent;
51574
+ if (!host) continue;
51530
51575
  out2.push({
51531
51576
  criteriaId: "1.3.1",
51532
51577
  el,
@@ -27,7 +27,7 @@ variables:
27
27
  ULTRA11Y_LANG: en
28
28
  # Exact by default: a CI report must say which engine produced it. The release script keeps
29
29
  # this pin aligned with the package version; override only for a deliberate upgrade test.
30
- ULTRA11Y_VERSION: '5.54.1'
30
+ ULTRA11Y_VERSION: '5.54.3'
31
31
  # Batches of 8 amortise the prompt; each accepted verdict is checkpointed before the next
32
32
  # batch, and later passes receive only the residue.
33
33
  ULTRA11Y_GRAIN: batch
package/src/collector.ts CHANGED
@@ -61,7 +61,26 @@ export const COLLECT_MAX_ELEMENTS = 5000;
61
61
  export const COLLECT_SNAPSHOT = `(() => {
62
62
  const PROPS = ${JSON.stringify(COLLECTED_CSS)};
63
63
  const MAX = ${COLLECT_MAX_ELEMENTS};
64
- const els = document.querySelectorAll('*');
64
+ // The ordinal is a JOIN KEY against parseHtml(dom), so the walk must enumerate elements
65
+ // exactly as a reparse of the serialisation below will (#101). querySelectorAll('*') did not:
66
+ // - an element appended INSIDE a raw-text element (Next's dev overlay puts <nextjs-portal>
67
+ // in a <script>) is serialised as that element's raw text, and a reparse reads text —
68
+ // one ordinal too many, and every digest refused from there on;
69
+ // - <template> contents are serialised and reparsed as elements, but live in
70
+ // template.content, which querySelectorAll never traverses — one ordinal too few.
71
+ // Pre-order, children of the raw-text elements HTML parsers (htmlparser2 included) treat as
72
+ // text skipped, template.content descended.
73
+ const RAW_TEXT = new Set(['script', 'style', 'title', 'textarea', 'xmp', 'iframe', 'noembed', 'noframes']);
74
+ const els = [];
75
+ const walkElements = (parent) => {
76
+ for (const child of parent.children) {
77
+ els.push(child);
78
+ const name = child.localName;
79
+ if (RAW_TEXT.has(name)) continue;
80
+ walkElements(name === 'template' && child.content ? child.content : child);
81
+ }
82
+ };
83
+ walkElements(document);
65
84
  const styles = [];
66
85
  const boxes = [];
67
86
  const n = Math.min(els.length, MAX);
@@ -170,6 +170,12 @@ const listStructure: Rule = {
170
170
  // projected into a parent component's <ul> at render — its real parent is unknown
171
171
  // to static analysis, so this is not a definite violation.
172
172
  if (parent.tag === "template" || ancestors(el).some((a) => a.tag === "template" || (a.tag !== "#fragment" && rendersElsewhere(a.tag)))) continue;
173
+ // A fragment at the ROOT of a returned JSX expression has no parent in this file: the
174
+ // caller decides, typically `<ul>{children}</ul>` (egapro's CompliancePathOptions, #106).
175
+ // Only a fragment nested inside a known element still has a provable parent.
176
+ let host: typeof parent | null = parent;
177
+ while (host && host.tag === "#fragment") host = host.parent;
178
+ if (!host) continue;
173
179
  out.push({
174
180
  criteriaId: "1.3.1",
175
181
  el,
@@ -13,7 +13,7 @@
13
13
  // trustworthy: it can say "non-conforming" because it can also say "I don't know".
14
14
  import { readFileSync } from "node:fs";
15
15
  import { contrastRatio, parseColor, type RGBA } from "../color.js";
16
- import { attr, type Doc, type El } from "../parse/html.js";
16
+ import { attr, visibleText, type Doc, type El } from "../parse/html.js";
17
17
  import { decodePng, dominantBackground, type Image } from "../pixel.js";
18
18
  import type { RenderSignals, StyleEntry } from "../types.js";
19
19
  import type { Rule, RuleFinding } from "./rule.js";
@@ -29,6 +29,18 @@ function hasDirectText(el: El): boolean {
29
29
  return el.children.some((c) => c.type === "text" && c.data.trim() !== "");
30
30
  }
31
31
 
32
+ // WCAG 1.4.3 and 1.4.11 exempt « inactive user interface components » (#104): a disabled
33
+ // control, or anything inside a disabled fieldset, or marked aria-disabled, by itself or an
34
+ // ancestor.
35
+ const DISABLEABLE = new Set(["button", "input", "select", "textarea", "option", "optgroup", "fieldset"]);
36
+ function inactive(el: El): boolean {
37
+ for (let n: El | null = el; n; n = n.parent) {
38
+ if (attr(n, "aria-disabled") === "true") return true;
39
+ if (DISABLEABLE.has(n.tag) && attr(n, "disabled") !== undefined) return true;
40
+ }
41
+ return false;
42
+ }
43
+
32
44
  /** Is this element painted at all? An invisible element cannot fail a contrast criterion. */
33
45
  function invisible(css: Record<string, string>): boolean {
34
46
  if (css.display === "none" || css.visibility === "hidden") return true;
@@ -105,7 +117,7 @@ const renderedContrast: Rule = {
105
117
  const index = elementIndex(doc);
106
118
  const out: RuleFinding[] = [];
107
119
  for (const [el, i] of index) {
108
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
120
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
109
121
  const css = styleAt(doc, i)?.css;
110
122
  if (!css || invisible(css)) continue;
111
123
  const fg = parseColor(css.color ?? "");
@@ -153,7 +165,7 @@ const renderedContrastPixel: Rule = {
153
165
  const index = elementIndex(doc);
154
166
  const out: RuleFinding[] = [];
155
167
  for (const [el, i] of index) {
156
- if (SKIP_TAGS.has(el.tag) || !hasDirectText(el)) continue;
168
+ if (SKIP_TAGS.has(el.tag) || !hasDirectText(el) || inactive(el)) continue;
157
169
  const css = styleAt(doc, i)?.css;
158
170
  if (!css || invisible(css)) continue;
159
171
  // Only where the CSSOM could NOT answer — otherwise renderedContrast already decided,
@@ -190,6 +202,11 @@ function hasNonColourAffordance(css: Record<string, string>, parentCss: Record<s
190
202
  if ((css.borderBottomStyle ?? "none") !== "none" && Number.parseFloat(css.borderBottomWidth ?? "0") > 0) return true;
191
203
  const bg = parseColor(css.backgroundColor ?? "");
192
204
  if (bg && bg.a > 0) return true;
205
+ // The DSFR paints its link underline with a `background-image` gradient (and
206
+ // `text-decoration: none`), and outlines its tertiary buttons with an inset `box-shadow`:
207
+ // both are visible, non-colour affordances (#103).
208
+ if ((css.backgroundImage ?? "none") !== "none") return true;
209
+ if ((css.boxShadow ?? "none") !== "none") return true;
193
210
  const w = Number.parseInt(css.fontWeight ?? "400", 10);
194
211
  const pw = Number.parseInt(parentCss?.fontWeight ?? "400", 10);
195
212
  if (Number.isFinite(w) && Number.isFinite(pw) && w >= pw + 200) return true;
@@ -203,6 +220,18 @@ function hasNonColourAffordance(css: Record<string, string>, parentCss: Record<s
203
220
  // is where the criterion applies; a nav or button-styled link is out of scope by construction.
204
221
  const TEXT_BLOCK = new Set(["p", "li", "dd", "dt", "td", "th", "blockquote", "figcaption", "caption"]);
205
222
 
223
+ const WORD = /[\p{L}\p{N}]/u;
224
+ /** Does `block` carry visible words OUTSIDE `link`? */
225
+ function hasSurroundingText(block: El, link: El): boolean {
226
+ for (const c of block.children) {
227
+ if (c === link) continue;
228
+ if (c.type === "text") {
229
+ if (WORD.test(c.data)) return true;
230
+ } else if (WORD.test(visibleText(c))) return true;
231
+ }
232
+ return false;
233
+ }
234
+
206
235
  const renderedLinkColourOnly: Rule = {
207
236
  id: "rendered-link-colour-only",
208
237
  criteria: ["1.4.1"],
@@ -215,6 +244,10 @@ const renderedLinkColourOnly: Rule = {
215
244
  if (el.tag !== "a" || !hasDirectText(el)) continue;
216
245
  const parent = el.parent;
217
246
  if (!parent || !TEXT_BLOCK.has(parent.tag)) continue; // only links in running text
247
+ // …and only AMONG text. A link that is its block's whole content — a menu entry, a skip
248
+ // link, a button-styled call to action in a <li> — is not distinguished from any
249
+ // surrounding text, because there is none (#103).
250
+ if (!hasSurroundingText(parent, el)) continue;
218
251
  const css = styleAt(doc, i)?.css;
219
252
  const pi = index.get(parent);
220
253
  const parentCss = pi === undefined ? undefined : styleAt(doc, pi)?.css;
@@ -272,9 +305,14 @@ const renderedNonTextContrast: Rule = {
272
305
  const index = elementIndex(doc);
273
306
  const out: RuleFinding[] = [];
274
307
  for (const [el, i] of index) {
275
- if (!BOUNDED_CONTROLS.has(el.tag)) continue;
308
+ if (!BOUNDED_CONTROLS.has(el.tag) || inactive(el)) continue;
276
309
  const type = (el.attribs.type ?? "").toLowerCase();
277
310
  if (el.tag === "input" && (type === "hidden" || type === "image")) continue;
311
+ // Understanding 1.4.11: a button identified by its VISIBLE TEXT needs no visible
312
+ // boundary — the text is the identifier, and its contrast is 1.4.3's question. Fields
313
+ // and text-less (icon-only) controls still need one (#103).
314
+ if (el.tag === "button" && WORD.test(visibleText(el))) continue;
315
+ if (el.tag === "input" && ["button", "submit", "reset"].includes(type) && WORD.test(el.attribs.value ?? "")) continue;
278
316
  const css = styleAt(doc, i)?.css;
279
317
  if (!css || invisible(css)) continue;
280
318
  // A shadow or an outline can BE the boundary, and neither is a colour we can compare
package/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Single source of truth for shared types + the embedded version. sync-version.mjs
2
2
  // rewrites VERSION at release time (kept in lockstep with package.json + SKILL.md).
3
- export const VERSION = "5.54.1";
3
+ export const VERSION = "5.54.3";
4
4
  export const SCHEMA_VERSION = 2;
5
5
 
6
6
  // Lang = the UI FRAME's language — the `L` localization tables each module (report,