ultra11y 5.57.1 → 5.57.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.57.1",
13
+ "version": "5.57.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.57.1",
4
+ "version": "5.57.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.57.1",
4
+ "version": "5.57.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",
@@ -44,7 +44,7 @@ import { fileURLToPath } from "node:url";
44
44
  // does not carry it, so a user's own ultra11y.js is never clobbered. Kept as text, not as
45
45
  // an export (see above).
46
46
  const ULTRA11Y_OPENCODE_PLUGIN = "ULTRA11Y_OPENCODE_PLUGIN";
47
- const ULTRA11Y_PLUGIN_VERSION = "5.57.1";
47
+ const ULTRA11Y_PLUGIN_VERSION = "5.57.2";
48
48
  const PLUGIN_ID = "ultra11y";
49
49
  const SKILL_NAMES = ["ultra11y", "review-a11y"];
50
50
 
@@ -353,47 +353,258 @@ function actionTimeout(limits, deadline) {
353
353
  const left = deadline ? deadline.left() : limits.actionTimeoutMs;
354
354
  return Math.max(1, Math.min(limits.actionTimeoutMs, left || limits.actionTimeoutMs));
355
355
  }
356
- var REFLOW_PROBE = `(() => {
356
+ var DEV_TOOL_HOSTS = ["nextjs-portal", "vite-error-overlay", "astro-dev-toolbar", "nuxt-devtools-container", "nuxt-devtools"];
357
+ var FRAMES = `
358
+ const __frames = () => new Promise((res) => {
359
+ let done = false;
360
+ const end = () => { if (!done) { done = true; res(true); } };
361
+ setTimeout(end, 200);
362
+ try { requestAnimationFrame(() => requestAnimationFrame(end)); } catch { end(); }
363
+ });
364
+ `;
365
+ var REFLOW_PROBE = `(async () => { ${PRELUDE} ${FRAMES}
366
+ await __frames();
357
367
  const el = document.scrollingElement || document.documentElement;
358
- return { horizontalScroll: el.scrollWidth > el.clientWidth + 2 };
359
- })()`;
360
- var REFLOW_ZOOM_PROBE = `(() => { ${PRELUDE}
361
- const root = document.documentElement;
362
- const prev = root.style.fontSize;
363
- root.style.fontSize = '200%';
364
- const hits = [];
365
- for (const e of Array.from(document.querySelectorAll('p,li,h1,h2,h3,h4,h5,h6,td,th,button,a,label,span'))) {
366
- if (!__vis(e)) continue;
367
- if ((e.textContent || '').trim().length < 8) continue;
368
+ const vw = el.clientWidth;
369
+ const horizontalScroll = el.scrollWidth > vw + 2;
370
+ if (!horizontalScroll) return { horizontalScroll };
371
+ const sx = window.scrollX || 0;
372
+ const contained = (e) => {
373
+ for (let n = e.parentElement; n && n !== document.body && n !== document.documentElement; n = n.parentElement) {
374
+ if (getComputedStyle(n).overflowX !== 'visible') return true;
375
+ }
376
+ return false;
377
+ };
378
+ const boxes = new Set();
379
+ const outer = [];
380
+ const content = [];
381
+ for (const e of Array.from(document.querySelectorAll('body, body *'))) {
382
+ const r = e.getBoundingClientRect();
383
+ if (r.width <= 0 || r.height <= 0) continue;
368
384
  const s = getComputedStyle(e);
369
- const clip = s.overflow === 'hidden' || s.overflowY === 'hidden' || s.overflowX === 'hidden';
370
- const noWrap = s.whiteSpace === 'nowrap' || s.textOverflow === 'ellipsis';
371
- if ((clip || noWrap) && (e.scrollHeight > e.clientHeight + 6 || e.scrollWidth > e.clientWidth + 6)) {
372
- hits.push({ selector: __sel(e), html: __html(e), detail: 'Texte tronqu\xE9/masqu\xE9 \xE0 200% (conteneur overflow:hidden / nowrap) \u2014 perte de contenu au zoom (1.4.4).' });
385
+ if (s.position === 'fixed' || s.display === 'none' || s.visibility === 'hidden') continue;
386
+ const boxOver = r.right + sx - vw;
387
+ const contentOver = s.overflowX === 'visible' ? r.left + sx + e.scrollWidth - vw : 0;
388
+ if (boxOver <= 2 && contentOver <= 2) continue;
389
+ if (contained(e)) continue;
390
+ if (boxOver > 2) {
391
+ boxes.add(e);
392
+ let top = true;
393
+ for (let n = e.parentElement; n; n = n.parentElement) if (boxes.has(n)) { top = false; break; }
394
+ if (top) outer.push([e, 'd\xE9borde de ' + Math.round(boxOver) + 'px \xE0 droite (largeur ' + Math.round(r.width) + 'px)']);
395
+ } else {
396
+ content.push([e, 'son contenu (texte ou pseudo-\xE9l\xE9ment) d\xE9borde de ' + Math.round(contentOver) + 'px \xE0 droite de la bo\xEEte']);
373
397
  }
374
- if (hits.length >= 12) break;
375
398
  }
376
- root.style.fontSize = prev;
377
- return hits;
399
+ // A box wider than the viewport is the cause; failing one, the DEEPEST element whose own
400
+ // content (a long word, a ::before/::after) spills out \u2014 its ancestors only carry the spill.
401
+ const deepest = content.filter(([e]) => !content.some(([o]) => o !== e && e.contains(o)) && !Array.from(boxes).some((b) => e.contains(b)));
402
+ const widening = outer.concat(deepest).slice(0, 5).map(([e, d]) => ({ selector: __sel(e), html: __html(e), detail: d }));
403
+ return { horizontalScroll, widening };
378
404
  })()`;
379
- var TEXT_SPACING_CSS = "* { line-height: 1.5 !important; letter-spacing: 0.12em !important; word-spacing: 0.16em !important; } p { margin-bottom: 2em !important; }";
380
- var TEXT_SPACING_PROBE = `(() => { ${PRELUDE}
381
- const hits = [];
382
- for (const e of Array.from(document.querySelectorAll('p,li,span,a,button,h1,h2,h3,h4,h5,h6,td,th,label,div'))) {
405
+ var STRESS_LIB = `${FRAMES}
406
+ const __pause = (ms) => new Promise((res) => setTimeout(res, ms));
407
+ const __CONTROLS = 'a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=checkbox],[role=radio],[role=tab],[role=switch],[tabindex]:not([tabindex="-1"])';
408
+ // How far the element's CONTENT \u2014 its text and its child boxes, as laid out \u2014 reaches past the
409
+ // padding box its overflow clips at. Not \`scrollWidth\`: that counts a child's margin too, and
410
+ // the spacing override gives every paragraph a 2em bottom margin, so a panel sized to its text
411
+ // would read as \xAB clipped \xBB by a margin nobody can see. And not one Range over the whole
412
+ // subtree either: an sr-only label is a 1px clipped box whose text is still laid out at full
413
+ // width, and counting that text would call every icon-only button \xAB clipped \xBB. A descendant
414
+ // that is not painted is skipped with everything inside it; one that clips its own overflow
415
+ // counts by its own box, its content being its own measurement; a panel's padding is not
416
+ // content, so a design system's tab container trimming its panel's bottom padding is not a loss.
417
+ const __REPLACED = ['img', 'svg', 'video', 'canvas', 'iframe', 'object', 'embed', 'input', 'select', 'textarea', 'button', 'meter', 'progress', 'audio'];
418
+ const __extent = (e) => {
419
+ let l = Infinity, t = Infinity, r = -Infinity, b = -Infinity;
420
+ const add = (q) => { if (!q || (!q.width && !q.height)) return; l = Math.min(l, q.left); t = Math.min(t, q.top); r = Math.max(r, q.right); b = Math.max(b, q.bottom); };
421
+ const range = document.createRange();
422
+ const walk = (n, depth) => {
423
+ for (const c of Array.from(n.childNodes)) {
424
+ if (c.nodeType === 3) {
425
+ if (!c.textContent || !c.textContent.trim()) continue;
426
+ range.selectNodeContents(c);
427
+ add(range.getBoundingClientRect());
428
+ } else if (c.nodeType === 1) {
429
+ const cs = getComputedStyle(c);
430
+ if (cs.display === 'contents') { if (depth < 40) walk(c, depth + 1); continue; }
431
+ if (!__vis(c)) continue;
432
+ // CONTENT, not decoration: a replaced element or a form control counts by its box, a
433
+ // box that clips counts by its box; any other element only through what it holds \u2014 its
434
+ // padding, its background and its margins are nothing a reader can lose.
435
+ if (__REPLACED.indexOf(c.localName) >= 0 || cs.overflowX !== 'visible' || cs.overflowY !== 'visible') add(c.getBoundingClientRect());
436
+ else if (depth < 40) walk(c, depth + 1);
437
+ }
438
+ }
439
+ };
440
+ walk(e, 0);
441
+ return l === Infinity ? null : { left: l, top: t, right: r, bottom: b, width: r - l, height: b - t };
442
+ };
443
+ const __excess = (e) => {
444
+ const r = e.getBoundingClientRect();
445
+ const left = r.left + e.clientLeft, top = r.top + e.clientTop;
446
+ const right = left + e.clientWidth, bottom = top + e.clientHeight;
447
+ const t = __extent(e);
448
+ if (!t) return { x: 0, y: 0, sw: 1, sh: 1 };
449
+ return {
450
+ x: Math.max(0, t.right - right) + Math.max(0, left - t.left),
451
+ y: Math.max(0, t.bottom - bottom) + Math.max(0, top - t.top),
452
+ sw: Math.max(1, t.width),
453
+ sh: Math.max(1, t.height),
454
+ };
455
+ };
456
+ const __clipsX = (s) => s.overflowX === 'hidden' || s.overflowX === 'clip' || s.overflow === 'hidden' || s.textOverflow === 'ellipsis';
457
+ const __clipsY = (s) => s.overflowY === 'hidden' || s.overflowY === 'clip' || s.overflow === 'hidden';
458
+ const __clipBase = (sel) => {
459
+ const m = new Map();
460
+ for (const e of Array.from(document.querySelectorAll(sel))) {
383
461
  if (!__vis(e)) continue;
384
462
  if ((e.textContent || '').trim().length < 8) continue;
463
+ // Only a box that CLIPS can lose content by clipping, and the stress changes spacing and
464
+ // size, never a box's overflow \u2014 so the rest of the page is not measured at all.
385
465
  const s = getComputedStyle(e);
386
- const clipped = (s.overflowX === 'hidden' || s.overflowY === 'hidden' || s.overflow === 'hidden') && (e.scrollHeight > e.clientHeight + 2 || e.scrollWidth > e.clientWidth + 2);
387
- const ellipsis = s.textOverflow === 'ellipsis' && e.scrollWidth > e.clientWidth + 2;
388
- if (clipped || ellipsis) {
389
- // No criterion id in the text: every rendering already names the criterion this finding
390
- // belongs to, and a hard-coded \xAB 1.4.12 \xBB is a WCAG number appearing inside a deliverable
391
- // that may be keyed on another standard entirely.
392
- hits.push({ selector: __sel(e), html: __html(e), detail: 'Texte tronqu\xE9/masqu\xE9 sous l\\'espacement de texte impos\xE9 \u2014 perte de contenu.' });
393
- }
394
- if (hits.length >= 20) break;
466
+ if (!__clipsX(s) && !__clipsY(s)) continue;
467
+ m.set(e, { ...__excess(e), slack: (parseFloat(s.fontSize) || 16) / 2 });
468
+ }
469
+ return m;
470
+ };
471
+ const __clipLost = (e, b, tol) => {
472
+ if (!e.isConnected || !__vis(e)) return false;
473
+ const s = getComputedStyle(e);
474
+ const now = __excess(e);
475
+ // Whole at baseline: any cut the stress makes is a loss. Cut by up to half a glyph (a fixed
476
+ // box shaving its descenders): the stress must cut MORE, in pixels and as a share of the
477
+ // content \u2014 a box sized in rem that hides a sliver at 100 % hides the same share at 200 %.
478
+ // Cut by more than that: hidden by design, never reported.
479
+ const lost = (clips, b0, s0, n0, s1) => {
480
+ if (!clips || n0 <= tol) return false;
481
+ if (b0 <= tol) return true;
482
+ if (b0 > Math.max(tol, b.slack)) return false;
483
+ return n0 - b0 > tol && n0 / s1 - b0 / s0 > 0.05;
484
+ };
485
+ return lost(__clipsX(s), b.x, b.sw, now.x, now.sw) || lost(__clipsY(s), b.y, b.sh, now.y, now.sh);
486
+ };
487
+ const __up = (n) => n.parentElement || (n.getRootNode && n.getRootNode() instanceof ShadowRoot ? n.getRootNode().host : null);
488
+ const __within = (n, e) => { for (; n; n = __up(n)) if (n === e) return true; return false; };
489
+ const __fixedish = (n) => {
490
+ for (; n && n !== document.documentElement; n = __up(n)) {
491
+ if (${JSON.stringify(DEV_TOOL_HOSTS)}.indexOf((n.localName || '').toLowerCase()) >= 0) return true;
492
+ const p = getComputedStyle(n).position;
493
+ if (p === 'fixed' || p === 'sticky') return true;
494
+ }
495
+ return false;
496
+ };
497
+ const __topAt = (e) => {
498
+ let r = e.getBoundingClientRect();
499
+ if (r.width < 1 || r.height < 1) return undefined;
500
+ const inView = (r) => {
501
+ const x = r.left + r.width / 2, y = r.top + r.height / 2;
502
+ return x >= 0 && y >= 0 && x < window.innerWidth && y < window.innerHeight;
503
+ };
504
+ if (!inView(r)) {
505
+ window.scrollTo({ left: Math.max(0, window.scrollX + r.left + r.width / 2 - window.innerWidth / 2), top: Math.max(0, window.scrollY + r.top + r.height / 2 - window.innerHeight / 2), behavior: 'instant' });
506
+ r = e.getBoundingClientRect();
507
+ if (!inView(r)) return undefined;
508
+ }
509
+ const x = r.left + r.width / 2, y = r.top + r.height / 2;
510
+ let t = document.elementFromPoint(x, y);
511
+ // Into open shadow roots: the host is not what sits on top, its rendered content is \u2014 and a
512
+ // dev-tools overlay's fixed layer lives in there.
513
+ for (let i = 0; t && t.shadowRoot && i < 8; i++) {
514
+ const d = t.shadowRoot.elementFromPoint(x, y);
515
+ if (!d || d === t) break;
516
+ t = d;
517
+ }
518
+ if (!t) return undefined;
519
+ if (__within(t, e)) return null;
520
+ if (t.tagName === 'LABEL' && t.control === e) return null;
521
+ if (__within(e, t)) return undefined;
522
+ return t;
523
+ };
524
+ const __hitBase = () => {
525
+ const m = new Set();
526
+ for (const e of Array.from(document.querySelectorAll(__CONTROLS))) {
527
+ if (!__vis(e)) continue;
528
+ if (__topAt(e) === null) m.add(e);
529
+ }
530
+ return m;
531
+ };
532
+ const __covered = (e) => {
533
+ if (!e.isConnected || !__vis(e)) return null;
534
+ const t = __topAt(e);
535
+ if (!t || __fixedish(t)) return null;
536
+ return t;
537
+ };
538
+ const __compare = async (base, tol, clipDetail, coverDetail, max) => {
539
+ const look = () => {
540
+ const clip = [];
541
+ for (const [e, b] of base.clip) if (__clipLost(e, b, tol)) clip.push(e);
542
+ const cover = [];
543
+ for (const e of base.hit) { const t = __covered(e); if (t) cover.push([e, t]); }
544
+ return { clip, cover };
545
+ };
546
+ await __frames();
547
+ let first = look();
548
+ if (first.clip.length || first.cover.length) {
549
+ await __pause(150);
550
+ await __frames();
551
+ const again = look();
552
+ const stillClip = new Set(again.clip);
553
+ const stillCover = new Map(again.cover);
554
+ first = { clip: first.clip.filter((e) => stillClip.has(e)), cover: first.cover.filter(([e]) => stillCover.has(e)).map(([e]) => [e, stillCover.get(e)]) };
555
+ }
556
+ const hits = [];
557
+ for (const e of first.clip) {
558
+ if (hits.length >= max) break;
559
+ hits.push({ selector: __sel(e), html: __html(e), detail: clipDetail });
560
+ }
561
+ for (const [e, t] of first.cover) {
562
+ if (hits.length >= max) break;
563
+ hits.push({ selector: __sel(e), html: __html(e), detail: coverDetail.replace('{by}', __sel(t)) });
395
564
  }
396
565
  return hits;
566
+ };
567
+ `;
568
+ var REFLOW_ZOOM_PROBE = `(async () => { ${PRELUDE} ${STRESS_LIB}
569
+ const root = document.documentElement;
570
+ const prev = root.style.fontSize;
571
+ const sx = window.scrollX, sy = window.scrollY;
572
+ const base = { clip: __clipBase('p,li,h1,h2,h3,h4,h5,h6,td,th,button,a,label,span,div'), hit: __hitBase() };
573
+ window.scrollTo({ left: sx, top: sy, behavior: 'instant' });
574
+ root.style.fontSize = '200%';
575
+ try {
576
+ return await __compare(base, 6,
577
+ 'Texte tronqu\xE9/masqu\xE9 \xE0 200 % alors qu\\'il \xE9tait enti\xE8rement visible au rendu normal \u2014 perte de contenu au zoom.',
578
+ 'Contr\xF4le recouvert par {by} \xE0 200 % alors qu\\'il ne l\\'\xE9tait pas au rendu normal \u2014 chevauchement, le contr\xF4le n\\'est plus atteignable \xE0 cet endroit.',
579
+ 12);
580
+ } finally {
581
+ root.style.fontSize = prev;
582
+ window.scrollTo({ left: sx, top: sy, behavior: 'instant' });
583
+ }
584
+ })()`;
585
+ var TEXT_SPACING_CSS = "* { line-height: 1.5 !important; letter-spacing: 0.12em !important; word-spacing: 0.16em !important; } p { margin-bottom: 2em !important; }";
586
+ var TEXT_SPACING_BASELINE_STEP = `(() => { ${PRELUDE} ${STRESS_LIB}
587
+ const sx = window.scrollX, sy = window.scrollY;
588
+ window.__u11ySpacingBase = { clip: __clipBase('p,li,span,a,button,h1,h2,h3,h4,h5,h6,td,th,label,div'), hit: __hitBase() };
589
+ window.scrollTo({ left: sx, top: sy, behavior: 'instant' });
590
+ return true;
591
+ })()`;
592
+ var TEXT_SPACING_PROBE = `(async () => { ${PRELUDE} ${STRESS_LIB}
593
+ const base = window.__u11ySpacingBase;
594
+ delete window.__u11ySpacingBase;
595
+ if (!base) throw new Error('ultra11y: the text-spacing baseline was not recorded before the override, so nothing can be compared');
596
+ const sx = window.scrollX, sy = window.scrollY;
597
+ try {
598
+ // No criterion id in the text: every rendering already names the criterion this finding
599
+ // belongs to, and a hard-coded \xAB 1.4.12 \xBB is a WCAG number appearing inside a deliverable
600
+ // that may be keyed on another standard entirely.
601
+ return await __compare(base, 2,
602
+ 'Texte tronqu\xE9/masqu\xE9 sous l\\'espacement de texte impos\xE9 alors qu\\'il \xE9tait enti\xE8rement visible au rendu normal \u2014 perte de contenu.',
603
+ 'Contr\xF4le recouvert par {by} sous l\\'espacement de texte impos\xE9 alors qu\\'il ne l\\'\xE9tait pas au rendu normal \u2014 chevauchement, le contr\xF4le n\\'est plus atteignable \xE0 cet endroit.',
604
+ 20);
605
+ } finally {
606
+ window.scrollTo({ left: sx, top: sy, behavior: 'instant' });
607
+ }
397
608
  })()`;
398
609
  function focusSetupExpr(scope = "", maxFocusables = PROBE_DEFAULTS.maxFocusables) {
399
610
  const rootExpr = scope ? `document.querySelectorAll(${JSON.stringify(scope)})` : `[document.documentElement]`;
@@ -476,7 +687,6 @@ function focusSetupExpr(scope = "", maxFocusables = PROBE_DEFAULTS.maxFocusables
476
687
  return { n: n, total: total };
477
688
  })()`;
478
689
  }
479
- var DEV_TOOL_HOSTS = ["nextjs-portal", "vite-error-overlay", "astro-dev-toolbar", "nuxt-devtools-container", "nuxt-devtools"];
480
690
  var FOCUS_CHECK_PROBE = `(() => {
481
691
  const e = document.activeElement;
482
692
  // FOCUS LEFT THE DOCUMENT \u2014 the normal end of a tab ring, and nothing to measure.
@@ -845,7 +1055,8 @@ async function runLiveProbes(page, opts = {}) {
845
1055
  }
846
1056
  }
847
1057
  if (want("1.4.12") && canStyle) {
848
- const handle = await bounded("1.4.12", () => page.addStyleTag({ content: TEXT_SPACING_CSS }));
1058
+ const based = await bounded("1.4.12", async () => await page.evaluate(TEXT_SPACING_BASELINE_STEP));
1059
+ const handle = based === null ? null : await bounded("1.4.12", () => page.addStyleTag({ content: TEXT_SPACING_CSS }));
849
1060
  if (handle) {
850
1061
  const r = await bounded("1.4.12", async () => await page.evaluate(TEXT_SPACING_PROBE));
851
1062
  await page.evaluate(REMOVE_TEXT_SPACING_STEP).catch(() => {
package/docker/runner.mjs CHANGED
@@ -4,6 +4,7 @@ const target = process.argv[2];
4
4
  const isFile = target.startsWith("/work/");
5
5
  const SNAPSHOT = process.env.ULTRA11Y_SNAPSHOT !== "0";
6
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 // With scripting on, a <noscript>'s content is raw TEXT to the browser, while the reparse\n // reads it as elements (#112). Parse that text with the page's own parser and count what\n // it yields, in place, so every later ordinal still lines up. The inert parsed nodes have\n // no computed style and an empty box, which the rules read as « nothing measured ».\n if (name === 'noscript' && child.children.length === 0 && (child.textContent || '').includes('<')) {\n const parsed = document.createElement('template');\n parsed.innerHTML = child.textContent || '';\n walkElements(parsed.content);\n continue;\n }\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
+ const REFLOW = "(async () => { \nconst __sel = (e) => {\n if (!e || !e.tagName) return '—';\n const esc = (v) => (typeof CSS !== 'undefined' && CSS.escape) ? CSS.escape(v) : String(v).replace(/[^a-zA-Z0-9_-]/g, '\\\\$&');\n const unique = (s) => { try { return document.querySelectorAll(s).length === 1; } catch { return false; } };\n const short = (n) => {\n const t = n.tagName.toLowerCase();\n if (n.id) return t + '#' + esc(n.id);\n const c = typeof n.className === 'string' ? n.className.trim().split(/\\s+/)[0] : '';\n return c ? t + '.' + esc(c) : t;\n };\n const first = short(e);\n if (unique(first)) return first;\n const parts = [];\n for (let n = e; n && n.tagName; n = n.parentElement) {\n let part = short(n);\n if (n.id && unique(part)) { parts.unshift(part); return parts.join(' > '); }\n const parent = n.parentElement;\n if (parent) {\n const same = Array.from(parent.children).filter((x) => x.tagName === n.tagName);\n if (same.length > 1) part += ':nth-of-type(' + (same.indexOf(n) + 1) + ')';\n }\n parts.unshift(part);\n const path = parts.join(' > ');\n if (unique(path)) return path;\n }\n return parts.join(' > ') || first;\n};\nconst __vis = (e) => {\n const r = e.getBoundingClientRect();\n if (r.width <= 4 || r.height <= 4) return false; // tiny / 1px sr-only boxes\n const s = getComputedStyle(e);\n if (s.display === 'none' || s.visibility === 'hidden' || parseFloat(s.opacity) === 0) return false;\n // visually-hidden \"screen-reader-only\" pattern (clip rect / clip-path inset) — present in\n // the a11y tree but not painted; must not be measured for clipping/target-size.\n if (s.clip && s.clip !== 'auto' && s.clip !== 'rect(auto, auto, auto, auto)') return false;\n if (s.clipPath && (s.clipPath.indexOf('inset(100%') >= 0 || s.clipPath.indexOf('inset(50%') >= 0)) return false;\n return true;\n};\nconst __html = (e) => (e.outerHTML || '').slice(0, 160);\n \nconst __frames = () => new Promise((res) => {\n let done = false;\n const end = () => { if (!done) { done = true; res(true); } };\n setTimeout(end, 200);\n try { requestAnimationFrame(() => requestAnimationFrame(end)); } catch { end(); }\n});\n\n await __frames();\n const el = document.scrollingElement || document.documentElement;\n const vw = el.clientWidth;\n const horizontalScroll = el.scrollWidth > vw + 2;\n if (!horizontalScroll) return { horizontalScroll };\n const sx = window.scrollX || 0;\n const contained = (e) => {\n for (let n = e.parentElement; n && n !== document.body && n !== document.documentElement; n = n.parentElement) {\n if (getComputedStyle(n).overflowX !== 'visible') return true;\n }\n return false;\n };\n const boxes = new Set();\n const outer = [];\n const content = [];\n for (const e of Array.from(document.querySelectorAll('body, body *'))) {\n const r = e.getBoundingClientRect();\n if (r.width <= 0 || r.height <= 0) continue;\n const s = getComputedStyle(e);\n if (s.position === 'fixed' || s.display === 'none' || s.visibility === 'hidden') continue;\n const boxOver = r.right + sx - vw;\n const contentOver = s.overflowX === 'visible' ? r.left + sx + e.scrollWidth - vw : 0;\n if (boxOver <= 2 && contentOver <= 2) continue;\n if (contained(e)) continue;\n if (boxOver > 2) {\n boxes.add(e);\n let top = true;\n for (let n = e.parentElement; n; n = n.parentElement) if (boxes.has(n)) { top = false; break; }\n if (top) outer.push([e, 'déborde de ' + Math.round(boxOver) + 'px à droite (largeur ' + Math.round(r.width) + 'px)']);\n } else {\n content.push([e, 'son contenu (texte ou pseudo-élément) déborde de ' + Math.round(contentOver) + 'px à droite de la boîte']);\n }\n }\n // A box wider than the viewport is the cause; failing one, the DEEPEST element whose own\n // content (a long word, a ::before/::after) spills out — its ancestors only carry the spill.\n const deepest = content.filter(([e]) => !content.some(([o]) => o !== e && e.contains(o)) && !Array.from(boxes).some((b) => e.contains(b)));\n const widening = outer.concat(deepest).slice(0, 5).map(([e, d]) => ({ selector: __sel(e), html: __html(e), detail: d }));\n return { horizontalScroll, widening };\n})()";
7
8
  const browser = await chromium.launch({ args: ["--no-sandbox", "--disable-dev-shm-usage"] });
8
9
  try {
9
10
  const page = await browser.newPage();
@@ -20,10 +21,9 @@ try {
20
21
  await page.addScriptTag({ content: axe.source });
21
22
  const axeRes = await page.evaluate(async () => await window.axe.run(document, { resultTypes: ["violations"] }));
22
23
  await page.setViewportSize({ width: 320, height: 800 });
23
- const reflow = await page.evaluate(() => {
24
- const el = document.scrollingElement || document.documentElement;
25
- return { horizontalScroll: el.scrollWidth > el.clientWidth + 2 };
26
- });
24
+ // The same probe the local runtime runs (src/probes.ts REFLOW_PROBE): it waits for the
25
+ // relayout and names the boxes that widen the page, instead of a bare yes/no.
26
+ const reflow = await page.evaluate(REFLOW);
27
27
  const violations = axeRes.violations.map((v) => ({
28
28
  id: v.id, impact: v.impact, help: v.help, tags: v.tags,
29
29
  nodes: v.nodes.slice(0, 10).map((n) => ({ target: n.target, html: (n.html || "").slice(0, 200) })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultra11y",
3
- "version": "5.57.1",
3
+ "version": "5.57.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",