ultra11y 5.51.0 → 5.51.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.51.0",
13
+ "version": "5.51.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.51.0",
4
+ "version": "5.51.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.51.0",
4
+ "version": "5.51.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.51.0";
30
+ const ULTRA11Y_PLUGIN_VERSION = "5.51.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 — 95 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 — 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:
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".
@@ -318,18 +318,18 @@ a test). See [`CONTRIBUTING.md`](CONTRIBUTING.md) and `skills/ultra11y/reference
318
318
 
319
319
  ### What RGAA automation actually covers
320
320
 
321
- The engine's 95 rules are not 95 RGAA criteria: several rules can evidence the same official
321
+ The engine's 96 rules are not 96 RGAA criteria: several rules can evidence the same official
322
322
  test, and a rule can detect a useful symptom without exhausting the criterion's alternatives,
323
323
  exceptions or relevance checks. The generated contract classifies all **258 official RGAA
324
324
  tests**:
325
325
 
326
- - **28 `static` tests across 20 criteria:** `1.1`, `2.1`, `5.7`, `5.8`, `6.1`, `6.2`, `7.1`,
327
- `8.2`, `8.3`, `8.4`, `8.5`, `8.10`, `9.3`, `10.1`, `10.12`, `11.1`, `11.5`,
326
+ - **29 `static` tests across 21 criteria:** `1.1`, `2.1`, `5.7`, `5.8`, `6.1`, `6.2`, `7.1`,
327
+ `8.2`, `8.3`, `8.4`, `8.5`, `8.10`, `9.3`, `10.1`, `10.12`, `11.1`, `11.2`, `11.5`,
328
328
  `11.6`, `11.8`, `11.9`.
329
329
  - **3 `rendered` tests across 3 criteria:** `1.1`, `8.1`, `10.7`.
330
- - Those two tiers cover **22 distinct criteria that can produce a deterministic `NC`**;
330
+ - Those two tiers cover **23 distinct criteria that can produce a deterministic `NC`**;
331
331
  `1.1` belongs to both.
332
- - **51 criteria receive a normative engine signal:** 22 have at least one decisive rule and
332
+ - **52 criteria receive a normative engine signal:** 23 have at least one decisive rule and
333
333
  42 receive candidate evidence, with overlap. One additional criterion receives only an
334
334
  advisory signal. A candidate is forwarded to adjudication and never changes a verdict by
335
335
  itself.
@@ -340,7 +340,7 @@ tests**:
340
340
  glossary names five, and covers “presentation built out of spaces” with two heuristics —
341
341
  every one of them a deliberate under-report, which is the safe direction for a finding and
342
342
  the wrong one for a conformity.
343
- - The remaining **227 `judgment` tests across 92 criteria** all enter the AI worklist,
343
+ - The remaining **226 `judgment` tests across 92 criteria** all enter the AI worklist,
344
344
  including an apparently absent subject whose `NA` still needs confirmation. Overall,
345
345
  **104 of 106 criteria require adjudication to earn `C`**.
346
346
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultra11y",
3
- "version": "5.51.0",
3
+ "version": "5.51.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",
@@ -151,6 +151,7 @@ const RULE_SC = {
151
151
  "skip-link-target-missing": ["2.4.1"], "bypass-blocks-missing": ["2.4.1"], "sortable-header-no-aria-sort": ["1.3.1"], "status-message-not-assertive": ["4.1.3"],
152
152
  "table-caption-missing": ["1.3.1"], "table-empty-data-cell": ["1.3.1"], "title-missing-empty": ["2.4.2"],
153
153
  "link-label-in-name-mismatch": ["2.5.3"],
154
+ "field-label-in-name-mismatch": ["2.5.3"],
154
155
  "invalid-aria-attr": ["4.1.2"], "invalid-aria-value": ["4.1.2"], "aria-required-attr": ["4.1.2"], "aria-prohibited-attr": ["4.1.2"],
155
156
  "dl-structure": ["1.3.1"], "on-input-context-change": ["3.2.2"],
156
157
  };
@@ -174,6 +175,10 @@ const JUDGMENT_CRITERIA = {
174
175
  "4.10": "« contrôlable par l’utilisateur » — l’arrêt/le réglage du son se constate au rendu, 1.4.2 ne prouve que l’absence d’autoplay détectable.",
175
176
  "8.4": "« le code de langue est-il pertinent ? » — 3.1.1 ne vérifie que la présence et la validité syntaxique de `lang`, pas sa cohérence avec la langue réelle du contenu.",
176
177
  "8.6": "« ce titre est-il pertinent ? » — 2.4.2 ne vérifie que la présence d’un `<title>` non vide.",
178
+ // One decisive rule now fails 11.2.5 (an aria-label that drops the visible <label>, #88), but
179
+ // that is a single condition of a single test: the criterion asks whether each label is
180
+ // PERTINENT, which no rule settles. It stays on the judgment side of the 11.1/11.2 split.
181
+ "11.2": "« chaque étiquette est-elle pertinente ? » — `field-label-in-name-mismatch` ne prouve que l’absence de l’intitulé visible dans un aria-label (11.2.5) ; la pertinence de l’étiquette se juge.",
177
182
  // Its tests are « static » because list-structure can PROVE a malformed list — but what they
178
183
  // ask about is « les informations regroupées VISUELLEMENT sous forme de liste », and the list
179
184
  // that fails them is the one drawn with no list markup at all. An absence of <ul> is not an
@@ -289,6 +294,8 @@ const RULE_TO_CRITERIA = {
289
294
  "radio-checkbox-group-ungrouped": ["11.5"], "date-fields-ungrouped": ["11.5"],
290
295
  "field-purpose-incomplete": ["11.1", "11.13"], "fieldset-legend-missing": ["11.6"], "form-button-empty-name": ["11.9"],
291
296
  "autocomplete-token-invalid": ["11.13"], "form-label-in-name-mismatch": ["11.9"],
297
+ // RGAA 11.2.5 condition 1: a field's aria-label must contain its visible <label> (#88).
298
+ "field-label-in-name-mismatch": ["11.2"],
292
299
  "error-not-associated": ["11.10"], "aria-invalid-no-description": ["11.10"],
293
300
  "axe:label": ["11.1"], "axe:form-field-multiple-labels": ["11.1"], "axe:select-name": ["11.1"], "axe:label-title-only": ["11.1"],
294
301
  // An ARIA field (role=textbox, combobox, checkbox, switch…) with no accessible name at all has
@@ -363,6 +370,7 @@ const DECISIVE_RULE_TESTS = {
363
370
  "11.1|axe:aria-toggle-field-name": ["1"],
364
371
  "11.6|fieldset-legend-missing": ["1"],
365
372
  "11.9|form-button-empty-name": ["1"],
373
+ "11.2|field-label-in-name-mismatch": ["5"],
366
374
  "11.9|form-label-in-name-mismatch": ["2"],
367
375
  "11.5|radio-checkbox-group-ungrouped": ["1"],
368
376
  "5.7|headers-attr-dangling": ["4"],
@@ -666,7 +666,7 @@ const RULE_SC_COVERAGE = {
666
666
  "2.4.3": ["positive-tabindex"],
667
667
  "2.4.7": ["rendered-focus-not-visible"],
668
668
  "2.4.4": ["link-empty-name", "icon-only-control-unnamed"],
669
- "2.5.3": ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch"],
669
+ "2.5.3": ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch", "field-label-in-name-mismatch"],
670
670
  "3.2.2": ["on-input-context-change"],
671
671
  "3.3.8": ["credential-entry-blocked"],
672
672
  "3.1.1": ["html-lang-missing", "document-language-missing", "html-lang-xml-lang-mismatch", "lang-invalid"],
@@ -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.51.0";
9
+ var VERSION = "5.51.2";
10
10
  var SCHEMA_VERSION = 2;
11
11
  var INAPPLICABLE_STATUS = "C";
12
12
 
@@ -952,7 +952,7 @@ var wcag_default = {
952
952
  level: "A",
953
953
  addedIn: "2.1",
954
954
  automatability: "judgment",
955
- ruleIds: ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch"],
955
+ ruleIds: ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch", "field-label-in-name-mismatch"],
956
956
  understanding: "https://www.w3.org/WAI/WCAG22/Understanding/label-in-name.html",
957
957
  techniques: [
958
958
  "ARIA14",
@@ -38856,6 +38856,16 @@ var MSG_CATALOG = {
38856
38856
  en: (p) => `Start aria-label with the visible text ("${p.visible} \u2026"), or drop aria-label and let the text name the control.`
38857
38857
  }
38858
38858
  },
38859
+ "field-label-in-name-mismatch": {
38860
+ message: {
38861
+ fr: (p) => `L'\xE9tiquette visible du champ \xAB ${p.visible} \xBB n'est pas contenue dans son nom accessible \xAB ${p.name} \xBB : l'aria-label la remplace (test RGAA 11.2.5).`,
38862
+ en: (p) => `The field's visible label "${p.visible}" is not contained in its accessible name "${p.name}": the aria-label replaces it.`
38863
+ },
38864
+ remediation: {
38865
+ fr: () => `Retirez l'aria-label pour que le <label> nomme le champ, ou faites-le contenir l'\xE9tiquette visible.`,
38866
+ en: () => `Drop the aria-label so the <label> names the field, or make it contain the visible label.`
38867
+ }
38868
+ },
38859
38869
  "headers-attr-dangling": {
38860
38870
  message: {
38861
38871
  fr: (p) => `headers="${p.ids}" ne d\xE9signe aucune cellule d'en-t\xEAte de ce tableau \u2014 l'association n'existe pas.`,
@@ -45383,18 +45393,26 @@ var rgaa_default = {
45383
45393
  ],
45384
45394
  wcag: ["2.4.6", "2.5.3", "3.3.2"],
45385
45395
  appliesTo: {
45386
- ruleIds: []
45396
+ ruleIds: ["field-label-in-name-mismatch"]
45387
45397
  },
45398
+ judgment: true,
45388
45399
  automation: {
45389
45400
  tests: {
45390
45401
  "1": "judgment",
45391
45402
  "2": "judgment",
45392
45403
  "3": "judgment",
45393
45404
  "4": "judgment",
45394
- "5": "judgment",
45405
+ "5": "static",
45395
45406
  "6": "judgment"
45396
45407
  },
45397
- rules: []
45408
+ rules: [
45409
+ {
45410
+ id: "field-label-in-name-mismatch",
45411
+ tests: ["5"],
45412
+ effect: "decisive-nc",
45413
+ rationale: "The observed failure exhausts the cited RGAA test."
45414
+ }
45415
+ ]
45398
45416
  }
45399
45417
  },
45400
45418
  {
@@ -49823,6 +49841,23 @@ function visibleLabelText(el) {
49823
49841
  }
49824
49842
  return collapse(out2);
49825
49843
  }
49844
+ var NOT_INTITULE_CLASS = /(^|\s)(fr-hint-text|fr-sr-only|sr-only|visually-hidden|visuallyhidden|hint-text|help-text)(\s|$)/;
49845
+ var FIELD_DESCENDANT = /* @__PURE__ */ new Set(["input", "select", "textarea", "button", "datalist", "output"]);
49846
+ function primaryLabelText(label) {
49847
+ let out2 = "";
49848
+ const nonText = /* @__PURE__ */ new Set(["script", "style", "title", "desc", "noscript", "template", "canvas", "video", "img", "svg"]);
49849
+ const walk3 = (n) => {
49850
+ if (n.type === "text") {
49851
+ out2 += n.data;
49852
+ return;
49853
+ }
49854
+ if (isLocallyDisplayHidden(n) || attr(n, "aria-hidden") === "true" || nonText.has(n.tag) || FIELD_DESCENDANT.has(n.tag)) return;
49855
+ if (NOT_INTITULE_CLASS.test(attr(n, "class") ?? "")) return;
49856
+ for (const child of n.children) walk3(child);
49857
+ };
49858
+ for (const child of label.children) walk3(child);
49859
+ return collapse(out2);
49860
+ }
49826
49861
  function visuallyRenderedText(el) {
49827
49862
  let out2 = "";
49828
49863
  const nonText = /* @__PURE__ */ new Set(["script", "style", "title", "desc", "noscript", "template", "canvas", "video", "img"]);
@@ -49837,6 +49872,11 @@ function visuallyRenderedText(el) {
49837
49872
  for (const child of el.children) walk3(child);
49838
49873
  return collapse(out2);
49839
49874
  }
49875
+ function labelledbyIsDynamic(el) {
49876
+ const literal = attr(el, "aria-labelledby");
49877
+ if (literal === void 0) return hasBoundAttr(el, "aria-labelledby");
49878
+ return literal.includes("{");
49879
+ }
49840
49880
  function ariaLabelledbyText(el, doc) {
49841
49881
  const ids2 = attr(el, "aria-labelledby");
49842
49882
  if (!ids2) return "";
@@ -49851,7 +49891,7 @@ var NAMELESS_BY_DEFAULT = /* @__PURE__ */ new Set(["submit", "reset"]);
49851
49891
  function accessibleName(el, doc) {
49852
49892
  const labelledby = ariaLabelledbyText(el, doc);
49853
49893
  if (labelledby) return labelledby;
49854
- if (hasBoundAttr(el, "aria-labelledby") && !attr(el, "aria-labelledby")) return "\xA0";
49894
+ if (labelledbyIsDynamic(el)) return "\xA0";
49855
49895
  const ariaLabel = (boundAttr(el, "aria-label") ?? "").trim();
49856
49896
  if (ariaLabel) return ariaLabel;
49857
49897
  if (el.tag === "img" || el.tag === "area") {
@@ -49883,8 +49923,7 @@ function isFormField2(el) {
49883
49923
  return true;
49884
49924
  }
49885
49925
  function controlLabel(el, doc) {
49886
- if (attr(el, "aria-labelledby") && ariaLabelledbyText(el, doc) || hasBoundAttr(el, "aria-labelledby") && !attr(el, "aria-labelledby"))
49887
- return { hasLabel: true, via: "aria-labelledby" };
49926
+ if (attr(el, "aria-labelledby") && ariaLabelledbyText(el, doc) || labelledbyIsDynamic(el)) return { hasLabel: true, via: "aria-labelledby" };
49888
49927
  if ((boundAttr(el, "aria-label") ?? "").trim()) return { hasLabel: true, via: "aria-label" };
49889
49928
  const id = attr(el, "id");
49890
49929
  if (id) {
@@ -51982,6 +52021,31 @@ var formLabelInNameMismatch = {
51982
52021
  severity: "majeur",
51983
52022
  run: (doc) => labelInNameMismatchFindings(doc, "form")
51984
52023
  };
52024
+ var fieldLabelInNameMismatch = {
52025
+ id: "field-label-in-name-mismatch",
52026
+ criteria: ["2.5.3"],
52027
+ severity: "majeur",
52028
+ run(doc) {
52029
+ const out2 = [];
52030
+ for (const el of doc.elements) {
52031
+ if (!isFormField2(el) || isHiddenFromAT(el) || hasDynamicSpread(el)) continue;
52032
+ const ariaLabel = (attr(el, "aria-label") ?? "").trim();
52033
+ if (!ariaLabel || ariaLabel.includes("{") || hasAttr(el, "aria-labelledby") || hasBoundAttr(el, "aria-labelledby")) continue;
52034
+ const id = attr(el, "id");
52035
+ const forLabel = id && !id.includes("{") ? doc.elements.find((e) => e.tag === "label" && attr(e, "for") === id) : void 0;
52036
+ const label = forLabel ?? ancestors(el).find((a) => a.tag === "label");
52037
+ if (!label || isHiddenFromAT(label)) continue;
52038
+ if (descendants(label).some((d) => d.tag === "slot" || d.tag !== "#fragment" && !isIntrinsic(d.tag))) continue;
52039
+ const visible2 = primaryLabelText(label);
52040
+ if (!visible2 || visible2.includes("{") || visible2.length < 3) continue;
52041
+ const name2 = normalizeName(ariaLabel);
52042
+ const intitule = normalizeName(visible2);
52043
+ if (!intitule || !name2 || name2.includes(intitule)) continue;
52044
+ out2.push({ criteriaId: "2.5.3", el, msgId: "field-label-in-name-mismatch", params: { visible: visible2, name: ariaLabel } });
52045
+ }
52046
+ return out2;
52047
+ }
52048
+ };
51985
52049
  var linkLabelInNameMismatch = {
51986
52050
  id: "link-label-in-name-mismatch",
51987
52051
  criteria: ["2.5.3"],
@@ -51996,7 +52060,8 @@ var linksRules = [
51996
52060
  controlNameTitleOnly,
51997
52061
  labelInNameMismatch,
51998
52062
  formLabelInNameMismatch,
51999
- linkLabelInNameMismatch
52063
+ linkLabelInNameMismatch,
52064
+ fieldLabelInNameMismatch
52000
52065
  ];
52001
52066
 
52002
52067
  // src/autofill.ts
@@ -52115,6 +52180,7 @@ var controlLabelMissing = {
52115
52180
  if (via === "title") continue;
52116
52181
  if (hasDynamicSpread(el)) continue;
52117
52182
  if (hasAttr(el, "placeholder")) continue;
52183
+ if ((attr(el, "id") ?? "").includes("{")) continue;
52118
52184
  out2.push({
52119
52185
  criteriaId: "4.1.2",
52120
52186
  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.51.0
6
+ version: 5.51.2
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.51.0";
9
+ var VERSION = "5.51.2";
10
10
  var SCHEMA_VERSION = 2;
11
11
  var INAPPLICABLE_STATUS = "C";
12
12
 
@@ -952,7 +952,7 @@ var wcag_default = {
952
952
  level: "A",
953
953
  addedIn: "2.1",
954
954
  automatability: "judgment",
955
- ruleIds: ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch"],
955
+ ruleIds: ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch", "field-label-in-name-mismatch"],
956
956
  understanding: "https://www.w3.org/WAI/WCAG22/Understanding/label-in-name.html",
957
957
  techniques: [
958
958
  "ARIA14",
@@ -38856,6 +38856,16 @@ var MSG_CATALOG = {
38856
38856
  en: (p) => `Start aria-label with the visible text ("${p.visible} \u2026"), or drop aria-label and let the text name the control.`
38857
38857
  }
38858
38858
  },
38859
+ "field-label-in-name-mismatch": {
38860
+ message: {
38861
+ fr: (p) => `L'\xE9tiquette visible du champ \xAB ${p.visible} \xBB n'est pas contenue dans son nom accessible \xAB ${p.name} \xBB : l'aria-label la remplace (test RGAA 11.2.5).`,
38862
+ en: (p) => `The field's visible label "${p.visible}" is not contained in its accessible name "${p.name}": the aria-label replaces it.`
38863
+ },
38864
+ remediation: {
38865
+ fr: () => `Retirez l'aria-label pour que le <label> nomme le champ, ou faites-le contenir l'\xE9tiquette visible.`,
38866
+ en: () => `Drop the aria-label so the <label> names the field, or make it contain the visible label.`
38867
+ }
38868
+ },
38859
38869
  "headers-attr-dangling": {
38860
38870
  message: {
38861
38871
  fr: (p) => `headers="${p.ids}" ne d\xE9signe aucune cellule d'en-t\xEAte de ce tableau \u2014 l'association n'existe pas.`,
@@ -45383,18 +45393,26 @@ var rgaa_default = {
45383
45393
  ],
45384
45394
  wcag: ["2.4.6", "2.5.3", "3.3.2"],
45385
45395
  appliesTo: {
45386
- ruleIds: []
45396
+ ruleIds: ["field-label-in-name-mismatch"]
45387
45397
  },
45398
+ judgment: true,
45388
45399
  automation: {
45389
45400
  tests: {
45390
45401
  "1": "judgment",
45391
45402
  "2": "judgment",
45392
45403
  "3": "judgment",
45393
45404
  "4": "judgment",
45394
- "5": "judgment",
45405
+ "5": "static",
45395
45406
  "6": "judgment"
45396
45407
  },
45397
- rules: []
45408
+ rules: [
45409
+ {
45410
+ id: "field-label-in-name-mismatch",
45411
+ tests: ["5"],
45412
+ effect: "decisive-nc",
45413
+ rationale: "The observed failure exhausts the cited RGAA test."
45414
+ }
45415
+ ]
45398
45416
  }
45399
45417
  },
45400
45418
  {
@@ -49823,6 +49841,23 @@ function visibleLabelText(el) {
49823
49841
  }
49824
49842
  return collapse(out2);
49825
49843
  }
49844
+ var NOT_INTITULE_CLASS = /(^|\s)(fr-hint-text|fr-sr-only|sr-only|visually-hidden|visuallyhidden|hint-text|help-text)(\s|$)/;
49845
+ var FIELD_DESCENDANT = /* @__PURE__ */ new Set(["input", "select", "textarea", "button", "datalist", "output"]);
49846
+ function primaryLabelText(label) {
49847
+ let out2 = "";
49848
+ const nonText = /* @__PURE__ */ new Set(["script", "style", "title", "desc", "noscript", "template", "canvas", "video", "img", "svg"]);
49849
+ const walk3 = (n) => {
49850
+ if (n.type === "text") {
49851
+ out2 += n.data;
49852
+ return;
49853
+ }
49854
+ if (isLocallyDisplayHidden(n) || attr(n, "aria-hidden") === "true" || nonText.has(n.tag) || FIELD_DESCENDANT.has(n.tag)) return;
49855
+ if (NOT_INTITULE_CLASS.test(attr(n, "class") ?? "")) return;
49856
+ for (const child of n.children) walk3(child);
49857
+ };
49858
+ for (const child of label.children) walk3(child);
49859
+ return collapse(out2);
49860
+ }
49826
49861
  function visuallyRenderedText(el) {
49827
49862
  let out2 = "";
49828
49863
  const nonText = /* @__PURE__ */ new Set(["script", "style", "title", "desc", "noscript", "template", "canvas", "video", "img"]);
@@ -49837,6 +49872,11 @@ function visuallyRenderedText(el) {
49837
49872
  for (const child of el.children) walk3(child);
49838
49873
  return collapse(out2);
49839
49874
  }
49875
+ function labelledbyIsDynamic(el) {
49876
+ const literal = attr(el, "aria-labelledby");
49877
+ if (literal === void 0) return hasBoundAttr(el, "aria-labelledby");
49878
+ return literal.includes("{");
49879
+ }
49840
49880
  function ariaLabelledbyText(el, doc) {
49841
49881
  const ids2 = attr(el, "aria-labelledby");
49842
49882
  if (!ids2) return "";
@@ -49851,7 +49891,7 @@ var NAMELESS_BY_DEFAULT = /* @__PURE__ */ new Set(["submit", "reset"]);
49851
49891
  function accessibleName(el, doc) {
49852
49892
  const labelledby = ariaLabelledbyText(el, doc);
49853
49893
  if (labelledby) return labelledby;
49854
- if (hasBoundAttr(el, "aria-labelledby") && !attr(el, "aria-labelledby")) return "\xA0";
49894
+ if (labelledbyIsDynamic(el)) return "\xA0";
49855
49895
  const ariaLabel = (boundAttr(el, "aria-label") ?? "").trim();
49856
49896
  if (ariaLabel) return ariaLabel;
49857
49897
  if (el.tag === "img" || el.tag === "area") {
@@ -49883,8 +49923,7 @@ function isFormField2(el) {
49883
49923
  return true;
49884
49924
  }
49885
49925
  function controlLabel(el, doc) {
49886
- if (attr(el, "aria-labelledby") && ariaLabelledbyText(el, doc) || hasBoundAttr(el, "aria-labelledby") && !attr(el, "aria-labelledby"))
49887
- return { hasLabel: true, via: "aria-labelledby" };
49926
+ if (attr(el, "aria-labelledby") && ariaLabelledbyText(el, doc) || labelledbyIsDynamic(el)) return { hasLabel: true, via: "aria-labelledby" };
49888
49927
  if ((boundAttr(el, "aria-label") ?? "").trim()) return { hasLabel: true, via: "aria-label" };
49889
49928
  const id = attr(el, "id");
49890
49929
  if (id) {
@@ -51982,6 +52021,31 @@ var formLabelInNameMismatch = {
51982
52021
  severity: "majeur",
51983
52022
  run: (doc) => labelInNameMismatchFindings(doc, "form")
51984
52023
  };
52024
+ var fieldLabelInNameMismatch = {
52025
+ id: "field-label-in-name-mismatch",
52026
+ criteria: ["2.5.3"],
52027
+ severity: "majeur",
52028
+ run(doc) {
52029
+ const out2 = [];
52030
+ for (const el of doc.elements) {
52031
+ if (!isFormField2(el) || isHiddenFromAT(el) || hasDynamicSpread(el)) continue;
52032
+ const ariaLabel = (attr(el, "aria-label") ?? "").trim();
52033
+ if (!ariaLabel || ariaLabel.includes("{") || hasAttr(el, "aria-labelledby") || hasBoundAttr(el, "aria-labelledby")) continue;
52034
+ const id = attr(el, "id");
52035
+ const forLabel = id && !id.includes("{") ? doc.elements.find((e) => e.tag === "label" && attr(e, "for") === id) : void 0;
52036
+ const label = forLabel ?? ancestors(el).find((a) => a.tag === "label");
52037
+ if (!label || isHiddenFromAT(label)) continue;
52038
+ if (descendants(label).some((d) => d.tag === "slot" || d.tag !== "#fragment" && !isIntrinsic(d.tag))) continue;
52039
+ const visible2 = primaryLabelText(label);
52040
+ if (!visible2 || visible2.includes("{") || visible2.length < 3) continue;
52041
+ const name2 = normalizeName(ariaLabel);
52042
+ const intitule = normalizeName(visible2);
52043
+ if (!intitule || !name2 || name2.includes(intitule)) continue;
52044
+ out2.push({ criteriaId: "2.5.3", el, msgId: "field-label-in-name-mismatch", params: { visible: visible2, name: ariaLabel } });
52045
+ }
52046
+ return out2;
52047
+ }
52048
+ };
51985
52049
  var linkLabelInNameMismatch = {
51986
52050
  id: "link-label-in-name-mismatch",
51987
52051
  criteria: ["2.5.3"],
@@ -51996,7 +52060,8 @@ var linksRules = [
51996
52060
  controlNameTitleOnly,
51997
52061
  labelInNameMismatch,
51998
52062
  formLabelInNameMismatch,
51999
- linkLabelInNameMismatch
52063
+ linkLabelInNameMismatch,
52064
+ fieldLabelInNameMismatch
52000
52065
  ];
52001
52066
 
52002
52067
  // src/autofill.ts
@@ -52115,6 +52180,7 @@ var controlLabelMissing = {
52115
52180
  if (via === "title") continue;
52116
52181
  if (hasDynamicSpread(el)) continue;
52117
52182
  if (hasAttr(el, "placeholder")) continue;
52183
+ if ((attr(el, "id") ?? "").includes("{")) continue;
52118
52184
  out2.push({
52119
52185
  criteriaId: "4.1.2",
52120
52186
  el,
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: ultra11y
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 95 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."
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 96 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.51.0
6
+ version: 5.51.2
7
7
  ---
8
8
 
9
9
  # ultra11y — audit WCAG 2.2 AA and write accessible markup
@@ -20,7 +20,7 @@ criteria (computed contrast, visible focus, zoom/reflow, content-on-hover) fall
20
20
  tier (axe-core in a real browser); a human is at most optional oversight. Gates stop any
21
21
  hallucinated non-conformity from surviving, and nothing is ever silently "conforming".
22
22
 
23
- **Do not confuse rules with criteria.** The bundle ships 95 static checks, WCAG AA has 55
23
+ **Do not confuse rules with criteria.** The bundle ships 96 static checks, WCAG AA has 55
24
24
  success criteria, and RGAA has 106 criteria. Several rules may evidence one criterion, one
25
25
  rule may contribute to several pack criteria, and most criteria remain open until a scan or
26
26
  an adjudication. The only honest run-level coverage is the grid's live provenance tally
@@ -88,7 +88,7 @@ criteria that map to it. SC ids, titles and levels are derived from the W3C sour
88
88
  |---|---|---|---|---|---|
89
89
  | 2.5.1 | Pointer Gestures | A | judgment | — | 13.10 |
90
90
  | 2.5.2 | Pointer Cancellation | A | judgment | — | 13.11 |
91
- | 2.5.3 | Label in Name | A | judgment | label-in-name-mismatch, form-label-in-name-mismatch, link-label-in-name-mismatch | 6.1, 7.1, 11.2, 11.9 |
91
+ | 2.5.3 | Label in Name | A | judgment | label-in-name-mismatch, form-label-in-name-mismatch, link-label-in-name-mismatch, field-label-in-name-mismatch | 6.1, 7.1, 11.2, 11.9 |
92
92
  | 2.5.4 | Motion Actuation | A | judgment | — | 13.12 |
93
93
  | 2.5.7 | Dragging Movements | AA | judgment | — | — |
94
94
  | 2.5.8 | Target Size (Minimum) | AA | needs-rendering | — | — |
@@ -81,7 +81,7 @@ The 106 criterion rows below are the one-by-one routing review. “AI + signals
81
81
  | 10.13 | 0 / 0 / 3 | 0 / 1 / 0 | no | AI + signals |
82
82
  | 10.14 | 0 / 0 / 2 | 0 / 0 / 0 | no | AI |
83
83
  | 11.1 | 1 / 0 / 2 | 5 / 8 / 0 | no | deterministic NC + AI residual |
84
- | 11.2 | 0 / 0 / 6 | 0 / 0 / 0 | no | AI |
84
+ | 11.2 | 1 / 0 / 5 | 1 / 0 / 0 | no | deterministic NC + AI residual |
85
85
  | 11.3 | 0 / 0 / 2 | 0 / 0 / 0 | no | AI |
86
86
  | 11.4 | 0 / 0 / 3 | 0 / 0 / 0 | no | AI |
87
87
  | 11.5 | 1 / 0 / 0 | 1 / 1 / 0 | no | deterministic NC + AI residual |
@@ -312,7 +312,7 @@ The 106 criterion rows below are the one-by-one routing review. “AI + signals
312
312
  | 11.2.2 | judgment | — | — |
313
313
  | 11.2.3 | judgment | — | — |
314
314
  | 11.2.4 | judgment | — | — |
315
- | 11.2.5 | judgment | — | — |
315
+ | 11.2.5 | static | `field-label-in-name-mismatch` | — |
316
316
  | 11.2.6 | judgment | — | — |
317
317
  | 11.3.1 | judgment | — | — |
318
318
  | 11.3.2 | judgment | — | — |
@@ -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.51.0";
9
+ var VERSION = "5.51.2";
10
10
  var SCHEMA_VERSION = 2;
11
11
  var INAPPLICABLE_STATUS = "C";
12
12
 
@@ -952,7 +952,7 @@ var wcag_default = {
952
952
  level: "A",
953
953
  addedIn: "2.1",
954
954
  automatability: "judgment",
955
- ruleIds: ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch"],
955
+ ruleIds: ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch", "field-label-in-name-mismatch"],
956
956
  understanding: "https://www.w3.org/WAI/WCAG22/Understanding/label-in-name.html",
957
957
  techniques: [
958
958
  "ARIA14",
@@ -38856,6 +38856,16 @@ var MSG_CATALOG = {
38856
38856
  en: (p) => `Start aria-label with the visible text ("${p.visible} \u2026"), or drop aria-label and let the text name the control.`
38857
38857
  }
38858
38858
  },
38859
+ "field-label-in-name-mismatch": {
38860
+ message: {
38861
+ fr: (p) => `L'\xE9tiquette visible du champ \xAB ${p.visible} \xBB n'est pas contenue dans son nom accessible \xAB ${p.name} \xBB : l'aria-label la remplace (test RGAA 11.2.5).`,
38862
+ en: (p) => `The field's visible label "${p.visible}" is not contained in its accessible name "${p.name}": the aria-label replaces it.`
38863
+ },
38864
+ remediation: {
38865
+ fr: () => `Retirez l'aria-label pour que le <label> nomme le champ, ou faites-le contenir l'\xE9tiquette visible.`,
38866
+ en: () => `Drop the aria-label so the <label> names the field, or make it contain the visible label.`
38867
+ }
38868
+ },
38859
38869
  "headers-attr-dangling": {
38860
38870
  message: {
38861
38871
  fr: (p) => `headers="${p.ids}" ne d\xE9signe aucune cellule d'en-t\xEAte de ce tableau \u2014 l'association n'existe pas.`,
@@ -45383,18 +45393,26 @@ var rgaa_default = {
45383
45393
  ],
45384
45394
  wcag: ["2.4.6", "2.5.3", "3.3.2"],
45385
45395
  appliesTo: {
45386
- ruleIds: []
45396
+ ruleIds: ["field-label-in-name-mismatch"]
45387
45397
  },
45398
+ judgment: true,
45388
45399
  automation: {
45389
45400
  tests: {
45390
45401
  "1": "judgment",
45391
45402
  "2": "judgment",
45392
45403
  "3": "judgment",
45393
45404
  "4": "judgment",
45394
- "5": "judgment",
45405
+ "5": "static",
45395
45406
  "6": "judgment"
45396
45407
  },
45397
- rules: []
45408
+ rules: [
45409
+ {
45410
+ id: "field-label-in-name-mismatch",
45411
+ tests: ["5"],
45412
+ effect: "decisive-nc",
45413
+ rationale: "The observed failure exhausts the cited RGAA test."
45414
+ }
45415
+ ]
45398
45416
  }
45399
45417
  },
45400
45418
  {
@@ -49823,6 +49841,23 @@ function visibleLabelText(el) {
49823
49841
  }
49824
49842
  return collapse(out2);
49825
49843
  }
49844
+ var NOT_INTITULE_CLASS = /(^|\s)(fr-hint-text|fr-sr-only|sr-only|visually-hidden|visuallyhidden|hint-text|help-text)(\s|$)/;
49845
+ var FIELD_DESCENDANT = /* @__PURE__ */ new Set(["input", "select", "textarea", "button", "datalist", "output"]);
49846
+ function primaryLabelText(label) {
49847
+ let out2 = "";
49848
+ const nonText = /* @__PURE__ */ new Set(["script", "style", "title", "desc", "noscript", "template", "canvas", "video", "img", "svg"]);
49849
+ const walk3 = (n) => {
49850
+ if (n.type === "text") {
49851
+ out2 += n.data;
49852
+ return;
49853
+ }
49854
+ if (isLocallyDisplayHidden(n) || attr(n, "aria-hidden") === "true" || nonText.has(n.tag) || FIELD_DESCENDANT.has(n.tag)) return;
49855
+ if (NOT_INTITULE_CLASS.test(attr(n, "class") ?? "")) return;
49856
+ for (const child of n.children) walk3(child);
49857
+ };
49858
+ for (const child of label.children) walk3(child);
49859
+ return collapse(out2);
49860
+ }
49826
49861
  function visuallyRenderedText(el) {
49827
49862
  let out2 = "";
49828
49863
  const nonText = /* @__PURE__ */ new Set(["script", "style", "title", "desc", "noscript", "template", "canvas", "video", "img"]);
@@ -49837,6 +49872,11 @@ function visuallyRenderedText(el) {
49837
49872
  for (const child of el.children) walk3(child);
49838
49873
  return collapse(out2);
49839
49874
  }
49875
+ function labelledbyIsDynamic(el) {
49876
+ const literal = attr(el, "aria-labelledby");
49877
+ if (literal === void 0) return hasBoundAttr(el, "aria-labelledby");
49878
+ return literal.includes("{");
49879
+ }
49840
49880
  function ariaLabelledbyText(el, doc) {
49841
49881
  const ids2 = attr(el, "aria-labelledby");
49842
49882
  if (!ids2) return "";
@@ -49851,7 +49891,7 @@ var NAMELESS_BY_DEFAULT = /* @__PURE__ */ new Set(["submit", "reset"]);
49851
49891
  function accessibleName(el, doc) {
49852
49892
  const labelledby = ariaLabelledbyText(el, doc);
49853
49893
  if (labelledby) return labelledby;
49854
- if (hasBoundAttr(el, "aria-labelledby") && !attr(el, "aria-labelledby")) return "\xA0";
49894
+ if (labelledbyIsDynamic(el)) return "\xA0";
49855
49895
  const ariaLabel = (boundAttr(el, "aria-label") ?? "").trim();
49856
49896
  if (ariaLabel) return ariaLabel;
49857
49897
  if (el.tag === "img" || el.tag === "area") {
@@ -49883,8 +49923,7 @@ function isFormField2(el) {
49883
49923
  return true;
49884
49924
  }
49885
49925
  function controlLabel(el, doc) {
49886
- if (attr(el, "aria-labelledby") && ariaLabelledbyText(el, doc) || hasBoundAttr(el, "aria-labelledby") && !attr(el, "aria-labelledby"))
49887
- return { hasLabel: true, via: "aria-labelledby" };
49926
+ if (attr(el, "aria-labelledby") && ariaLabelledbyText(el, doc) || labelledbyIsDynamic(el)) return { hasLabel: true, via: "aria-labelledby" };
49888
49927
  if ((boundAttr(el, "aria-label") ?? "").trim()) return { hasLabel: true, via: "aria-label" };
49889
49928
  const id = attr(el, "id");
49890
49929
  if (id) {
@@ -51982,6 +52021,31 @@ var formLabelInNameMismatch = {
51982
52021
  severity: "majeur",
51983
52022
  run: (doc) => labelInNameMismatchFindings(doc, "form")
51984
52023
  };
52024
+ var fieldLabelInNameMismatch = {
52025
+ id: "field-label-in-name-mismatch",
52026
+ criteria: ["2.5.3"],
52027
+ severity: "majeur",
52028
+ run(doc) {
52029
+ const out2 = [];
52030
+ for (const el of doc.elements) {
52031
+ if (!isFormField2(el) || isHiddenFromAT(el) || hasDynamicSpread(el)) continue;
52032
+ const ariaLabel = (attr(el, "aria-label") ?? "").trim();
52033
+ if (!ariaLabel || ariaLabel.includes("{") || hasAttr(el, "aria-labelledby") || hasBoundAttr(el, "aria-labelledby")) continue;
52034
+ const id = attr(el, "id");
52035
+ const forLabel = id && !id.includes("{") ? doc.elements.find((e) => e.tag === "label" && attr(e, "for") === id) : void 0;
52036
+ const label = forLabel ?? ancestors(el).find((a) => a.tag === "label");
52037
+ if (!label || isHiddenFromAT(label)) continue;
52038
+ if (descendants(label).some((d) => d.tag === "slot" || d.tag !== "#fragment" && !isIntrinsic(d.tag))) continue;
52039
+ const visible2 = primaryLabelText(label);
52040
+ if (!visible2 || visible2.includes("{") || visible2.length < 3) continue;
52041
+ const name2 = normalizeName(ariaLabel);
52042
+ const intitule = normalizeName(visible2);
52043
+ if (!intitule || !name2 || name2.includes(intitule)) continue;
52044
+ out2.push({ criteriaId: "2.5.3", el, msgId: "field-label-in-name-mismatch", params: { visible: visible2, name: ariaLabel } });
52045
+ }
52046
+ return out2;
52047
+ }
52048
+ };
51985
52049
  var linkLabelInNameMismatch = {
51986
52050
  id: "link-label-in-name-mismatch",
51987
52051
  criteria: ["2.5.3"],
@@ -51996,7 +52060,8 @@ var linksRules = [
51996
52060
  controlNameTitleOnly,
51997
52061
  labelInNameMismatch,
51998
52062
  formLabelInNameMismatch,
51999
- linkLabelInNameMismatch
52063
+ linkLabelInNameMismatch,
52064
+ fieldLabelInNameMismatch
52000
52065
  ];
52001
52066
 
52002
52067
  // src/autofill.ts
@@ -52115,6 +52180,7 @@ var controlLabelMissing = {
52115
52180
  if (via === "title") continue;
52116
52181
  if (hasDynamicSpread(el)) continue;
52117
52182
  if (hasAttr(el, "placeholder")) continue;
52183
+ if ((attr(el, "id") ?? "").includes("{")) continue;
52118
52184
  out2.push({
52119
52185
  criteriaId: "4.1.2",
52120
52186
  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.51.0'
30
+ ULTRA11Y_VERSION: '5.51.2'
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
@@ -4562,18 +4562,26 @@
4562
4562
  ],
4563
4563
  "wcag": ["2.4.6", "2.5.3", "3.3.2"],
4564
4564
  "appliesTo": {
4565
- "ruleIds": []
4565
+ "ruleIds": ["field-label-in-name-mismatch"]
4566
4566
  },
4567
+ "judgment": true,
4567
4568
  "automation": {
4568
4569
  "tests": {
4569
4570
  "1": "judgment",
4570
4571
  "2": "judgment",
4571
4572
  "3": "judgment",
4572
4573
  "4": "judgment",
4573
- "5": "judgment",
4574
+ "5": "static",
4574
4575
  "6": "judgment"
4575
4576
  },
4576
- "rules": []
4577
+ "rules": [
4578
+ {
4579
+ "id": "field-label-in-name-mismatch",
4580
+ "tests": ["5"],
4581
+ "effect": "decisive-nc",
4582
+ "rationale": "The observed failure exhausts the cited RGAA test."
4583
+ }
4584
+ ]
4577
4585
  }
4578
4586
  },
4579
4587
  {
@@ -934,7 +934,7 @@
934
934
  "level": "A",
935
935
  "addedIn": "2.1",
936
936
  "automatability": "judgment",
937
- "ruleIds": ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch"],
937
+ "ruleIds": ["label-in-name-mismatch", "form-label-in-name-mismatch", "link-label-in-name-mismatch", "field-label-in-name-mismatch"],
938
938
  "understanding": "https://www.w3.org/WAI/WCAG22/Understanding/label-in-name.html",
939
939
  "techniques": [
940
940
  "ARIA14",
package/src/messages.ts CHANGED
@@ -164,6 +164,17 @@ export const MSG_CATALOG: Record<string, MsgEntry> = {
164
164
  en: (p) => `Start aria-label with the visible text ("${p.visible} …"), or drop aria-label and let the text name the control.`,
165
165
  },
166
166
  },
167
+ "field-label-in-name-mismatch": {
168
+ message: {
169
+ fr: (p) =>
170
+ `L'étiquette visible du champ « ${p.visible} » n'est pas contenue dans son nom accessible « ${p.name} » : l'aria-label la remplace (test RGAA 11.2.5).`,
171
+ en: (p) => `The field's visible label "${p.visible}" is not contained in its accessible name "${p.name}": the aria-label replaces it.`,
172
+ },
173
+ remediation: {
174
+ fr: () => `Retirez l'aria-label pour que le <label> nomme le champ, ou faites-le contenir l'étiquette visible.`,
175
+ en: () => `Drop the aria-label so the <label> names the field, or make it contain the visible label.`,
176
+ },
177
+ },
167
178
  "headers-attr-dangling": {
168
179
  message: {
169
180
  fr: (p) => `headers="${p.ids}" ne désigne aucune cellule d'en-tête de ce tableau — l'association n'existe pas.`,
package/src/name.ts CHANGED
@@ -195,6 +195,33 @@ export function visibleLabelText(el: El): string {
195
195
  return collapse(out);
196
196
  }
197
197
 
198
+ // A hint or a visually hidden span inside a <label> is not what the user reads as the field's
199
+ // intitulé: the DSFR renders `.fr-hint-text` as a second, smaller line under it, and an sr-only
200
+ // span is not visible at all. Comparing an aria-label against them would demand that the name
201
+ // repeat help text, which neither RGAA 11.2.5 nor WCAG 2.5.3 asks.
202
+ const NOT_INTITULE_CLASS = /(^|\s)(fr-hint-text|fr-sr-only|sr-only|visually-hidden|visuallyhidden|hint-text|help-text)(\s|$)/;
203
+ const FIELD_DESCENDANT = new Set(["input", "select", "textarea", "button", "datalist", "output"]);
204
+
205
+ /** The PRIMARY visible text of a `<label>` — its intitulé — for the label-in-name comparison of
206
+ * a form field: hidden subtrees, aria-hidden decoration, hint/sr-only spans and the nested
207
+ * field itself (a wrapping label contains the <select> whose options are not label text) are
208
+ * left out. Literal text only; a caller must still refuse an interpolated result. */
209
+ export function primaryLabelText(label: El): string {
210
+ let out = "";
211
+ const nonText = new Set(["script", "style", "title", "desc", "noscript", "template", "canvas", "video", "img", "svg"]);
212
+ const walk = (n: HNode): void => {
213
+ if (n.type === "text") {
214
+ out += n.data;
215
+ return;
216
+ }
217
+ if (isLocallyDisplayHidden(n) || attr(n, "aria-hidden") === "true" || nonText.has(n.tag) || FIELD_DESCENDANT.has(n.tag)) return;
218
+ if (NOT_INTITULE_CLASS.test(attr(n, "class") ?? "")) return;
219
+ for (const child of n.children) walk(child);
220
+ };
221
+ for (const child of label.children) walk(child);
222
+ return collapse(out);
223
+ }
224
+
198
225
  /** Literal text that can visibly paint, regardless of accessibility-tree exposure.
199
226
  * `aria-hidden` removes semantics, not pixels; only rendering-hidden subtrees are excluded. */
200
227
  export function visuallyRenderedText(el: El): string {
@@ -212,6 +239,17 @@ export function visuallyRenderedText(el: El): string {
212
239
  return collapse(out);
213
240
  }
214
241
 
242
+ /** An aria-labelledby whose value the parse cannot know: a framework binding
243
+ * (`:aria-labelledby`, `v-bind:`, where the literal attribute is absent) or a JSX expression
244
+ * (`aria-labelledby={labelId}`, serialised with its braces). It names the element — the ids
245
+ * are just not resolvable here — so it must never be read as the literal id `{labelId}` and
246
+ * reported dangling (#94). Same treatment `aria-label={x}` has always had. */
247
+ export function labelledbyIsDynamic(el: El): boolean {
248
+ const literal = attr(el, "aria-labelledby");
249
+ if (literal === undefined) return hasBoundAttr(el, "aria-labelledby");
250
+ return literal.includes("{");
251
+ }
252
+
215
253
  function ariaLabelledbyText(el: El, doc: Doc): string {
216
254
  const ids = attr(el, "aria-labelledby");
217
255
  if (!ids) return "";
@@ -231,7 +269,7 @@ export function accessibleName(el: El, doc: Doc): string {
231
269
  // names the element — treat as present so we don't hallucinate a missing name)
232
270
  const labelledby = ariaLabelledbyText(el, doc);
233
271
  if (labelledby) return labelledby;
234
- if (hasBoundAttr(el, "aria-labelledby") && !attr(el, "aria-labelledby")) return " ";
272
+ if (labelledbyIsDynamic(el)) return " ";
235
273
  // 2. aria-label (incl. dynamic `:aria-label`/`v-bind:` binding → value unknown but present)
236
274
  const ariaLabel = (boundAttr(el, "aria-label") ?? "").trim();
237
275
  if (ariaLabel) return ariaLabel;
@@ -279,8 +317,7 @@ export function controlLabel(el: El, doc: Doc): LabelInfo {
279
317
  // Mirror accessibleName's guard: a labelledby is a real label only when it resolves to
280
318
  // text, OR is a DYNAMIC binding (present but value unknown). A literal aria-labelledby
281
319
  // whose target is missing/empty names nothing — the field is effectively unlabeled.
282
- if ((attr(el, "aria-labelledby") && ariaLabelledbyText(el, doc)) || (hasBoundAttr(el, "aria-labelledby") && !attr(el, "aria-labelledby")))
283
- return { hasLabel: true, via: "aria-labelledby" };
320
+ if ((attr(el, "aria-labelledby") && ariaLabelledbyText(el, doc)) || labelledbyIsDynamic(el)) return { hasLabel: true, via: "aria-labelledby" };
284
321
  if ((boundAttr(el, "aria-label") ?? "").trim()) return { hasLabel: true, via: "aria-label" };
285
322
  const id = attr(el, "id");
286
323
  if (id) {
@@ -62,6 +62,11 @@ const controlLabelMissing: Rule = {
62
62
  // aria-label/aria-labelledby we can't see — don't assert a missing label.
63
63
  if (hasDynamicSpread(el)) continue;
64
64
  if (hasAttr(el, "placeholder")) continue; // reported by placeholder-as-label
65
+ // An id the CALLER supplies (`id={inputId}`) can be targeted by any `<label htmlFor>` the
66
+ // caller renders: the shared-component pattern. Nothing in this document can prove the
67
+ // field unlabelled, and a blocking NC on it is a guess (#94). The rendered tier, where
68
+ // ids are resolved, decides — `axe:label` and this very rule on the page snapshots.
69
+ if ((attr(el, "id") ?? "").includes("{")) continue;
65
70
  out.push({
66
71
  criteriaId: "4.1.2",
67
72
  el,
@@ -1,8 +1,18 @@
1
1
  // Theme 6 / 7 — Links & buttons: accessible-name presence (empty-name + icon-only).
2
2
  import type { Doc, El } from "../parse/html.js";
3
- import { attr, boundAttr, hasAttr, hasBoundAttr, ancestors, descendants, visibleText } from "../parse/html.js";
3
+ import { attr, boundAttr, hasAttr, hasBoundAttr, hasDynamicSpread, ancestors, descendants, visibleText } from "../parse/html.js";
4
4
  import { isIntrinsic } from "../parse/jsx-bridge.js";
5
- import { accessibleName, mayInjectContent, isButtonInput, isFormField, controlLabel, isNameExempt, visibleLabelText } from "../name.js";
5
+ import {
6
+ accessibleName,
7
+ mayInjectContent,
8
+ isButtonInput,
9
+ isFormField,
10
+ controlLabel,
11
+ isHiddenFromAT,
12
+ isNameExempt,
13
+ primaryLabelText,
14
+ visibleLabelText,
15
+ } from "../name.js";
6
16
  import type { Rule, RuleFinding } from "./rule.js";
7
17
 
8
18
  function hasIconChild(el: El): boolean {
@@ -255,6 +265,42 @@ const formLabelInNameMismatch: Rule = {
255
265
  run: (doc) => labelInNameMismatchFindings(doc, "form"),
256
266
  };
257
267
 
268
+ // RGAA 11.2.5 (condition 1) / WCAG 2.5.3 for FORM FIELDS. A field's visible label is not its own
269
+ // content but the <label> associated with it (by `for`, or by wrapping); when a literal
270
+ // aria-label replaces that label, the name must still contain it. egapro#4919 shipped exactly
271
+ // this: a file input named « Sélectionner des fichiers » under a label asking for the CSE
272
+ // opinion — a screen-reader user hears a generic control, a voice-control user cannot say what
273
+ // they see. Same conservatism as the three rules above: literal text on both sides, no
274
+ // aria-labelledby (which wins over aria-label and is a different question), no spread, labels
275
+ // of a glyph's length are symbols (a particular case of 11.2.5), hidden labels or fields prove
276
+ // nothing.
277
+ const fieldLabelInNameMismatch: Rule = {
278
+ id: "field-label-in-name-mismatch",
279
+ criteria: ["2.5.3"],
280
+ severity: "majeur",
281
+ run(doc: Doc): RuleFinding[] {
282
+ const out: RuleFinding[] = [];
283
+ for (const el of doc.elements) {
284
+ if (!isFormField(el) || isHiddenFromAT(el) || hasDynamicSpread(el)) continue;
285
+ const ariaLabel = (attr(el, "aria-label") ?? "").trim();
286
+ if (!ariaLabel || ariaLabel.includes("{") || hasAttr(el, "aria-labelledby") || hasBoundAttr(el, "aria-labelledby")) continue;
287
+ const id = attr(el, "id");
288
+ const forLabel = id && !id.includes("{") ? doc.elements.find((e) => e.tag === "label" && attr(e, "for") === id) : undefined;
289
+ const label = forLabel ?? ancestors(el).find((a) => a.tag === "label");
290
+ if (!label || isHiddenFromAT(label)) continue;
291
+ // A child component or slot may render more label text than the parse can see.
292
+ if (descendants(label).some((d) => d.tag === "slot" || (d.tag !== "#fragment" && !isIntrinsic(d.tag)))) continue;
293
+ const visible = primaryLabelText(label);
294
+ if (!visible || visible.includes("{") || visible.length < 3) continue;
295
+ const name = normalizeName(ariaLabel);
296
+ const intitule = normalizeName(visible);
297
+ if (!intitule || !name || name.includes(intitule)) continue;
298
+ out.push({ criteriaId: "2.5.3", el, msgId: "field-label-in-name-mismatch", params: { visible, name: ariaLabel } });
299
+ }
300
+ return out;
301
+ },
302
+ };
303
+
258
304
  const linkLabelInNameMismatch: Rule = {
259
305
  id: "link-label-in-name-mismatch",
260
306
  criteria: ["2.5.3"],
@@ -271,4 +317,5 @@ export const linksRules: Rule[] = [
271
317
  labelInNameMismatch,
272
318
  formLabelInNameMismatch,
273
319
  linkLabelInNameMismatch,
320
+ fieldLabelInNameMismatch,
274
321
  ];
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.51.0";
3
+ export const VERSION = "5.51.2";
4
4
  export const SCHEMA_VERSION = 2;
5
5
 
6
6
  // Lang = the UI FRAME's language — the `L` localization tables each module (report,