Skip to content

Commit 995a269

Browse files
authored
fix: name the image role in role-img-alt and svg-img-alt metadata (#5279)
Follow-up to #5248. Since that change, `role-img-alt` and `svg-img-alt` match both `role="img"` and `role="image"` (via `:is([role='img'], [role='image'])`), but their metadata still named only `img` — so an author who wrote `<div role="image">` got a message referencing a role they didn't write. ## Changes - **`role-img-alt`** — description/help now name `[role="img"]` **and** `[role="image"]`. - **`svg-img-alt`** — description/help now include the `image` role alongside `img`/`graphics-document`/`graphics-symbol`. - Regenerated `locales/_template.json` and `doc/rule-descriptions.md` (via `pnpm run build`). ## Notes - Editing these four strings **invalidates the existing translations** for those keys until they're retranslated — this was deliberately deferred from #5248 and is expected. Only `locales/_template.json` is regenerated here; the translated `locales/*.json` files are left for the translation workflow. - A **matching `axe-rule-help` update** (the `role-img-alt`/`svg-img-alt` help pages) is a follow-up, tracked separately. Closes #5272
1 parent 8ff5ac6 commit 995a269

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

doc/rule-descriptions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@
6666
| [nested-interactive](https://dequeuniversity.com/rules/axe/4.12/nested-interactive?application=RuleDescription) | Ensure interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies | Serious | cat.keyboard, wcag2a, wcag412, TTv5, TT6.a, EN-301-549, EN-9.4.1.2, RGAAv4, RGAA-7.1.1 | failure, needs&nbsp;review | [307n5z](https://act-rules.github.io/rules/307n5z) |
6767
| [no-autoplay-audio](https://dequeuniversity.com/rules/axe/4.12/no-autoplay-audio?application=RuleDescription) | Ensure &lt;video&gt; or &lt;audio&gt; elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio | Moderate | cat.time-and-media, wcag2a, wcag142, TTv5, TT2.a, EN-301-549, EN-9.1.4.2, ACT, RGAAv4, RGAA-4.10.1 | needs&nbsp;review | [80f0bf](https://act-rules.github.io/rules/80f0bf) |
6868
| [object-alt](https://dequeuniversity.com/rules/axe/4.12/object-alt?application=RuleDescription) | Ensure &lt;object&gt; elements have alternative text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, EN-301-549, EN-9.1.1.1, RGAAv4, RGAA-1.1.6 | failure, needs&nbsp;review | [8fc3b6](https://act-rules.github.io/rules/8fc3b6) |
69-
| [role-img-alt](https://dequeuniversity.com/rules/axe/4.12/role-img-alt?application=RuleDescription) | Ensure [role=&quot;img&quot;] elements have alternative text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, ACT, RGAAv4, RGAA-1.1.1 | failure, needs&nbsp;review | [23a2a8](https://act-rules.github.io/rules/23a2a8) |
69+
| [role-img-alt](https://dequeuniversity.com/rules/axe/4.12/role-img-alt?application=RuleDescription) | Ensure [role=&quot;img&quot;] and [role=&quot;image&quot;] elements have alternative text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, ACT, RGAAv4, RGAA-1.1.1 | failure, needs&nbsp;review | [23a2a8](https://act-rules.github.io/rules/23a2a8) |
7070
| [scrollable-region-focusable](https://dequeuniversity.com/rules/axe/4.12/scrollable-region-focusable?application=RuleDescription) | Ensure elements that have scrollable content are accessible by keyboard in Safari | Serious | cat.keyboard, wcag2a, wcag211, wcag213, TTv5, TT4.a, EN-301-549, EN-9.2.1.1, EN-9.2.1.3, RGAAv4, RGAA-7.3.2 | failure | [0ssw9k](https://act-rules.github.io/rules/0ssw9k) |
7171
| [select-name](https://dequeuniversity.com/rules/axe/4.12/select-name?application=RuleDescription) | Ensure select element has an accessible name | Critical | cat.forms, wcag2a, wcag412, section508, section508.22.n, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT, RGAAv4, RGAA-11.1.1 | failure, needs&nbsp;review | [e086e5](https://act-rules.github.io/rules/e086e5) |
7272
| [server-side-image-map](https://dequeuniversity.com/rules/axe/4.12/server-side-image-map?application=RuleDescription) | Ensure that server-side image maps are not used | Minor | cat.text-alternatives, wcag2a, wcag211, section508, section508.22.f, TTv5, TT4.a, EN-301-549, EN-9.2.1.1, RGAAv4, RGAA-1.1.4 | needs&nbsp;review | |
7373
| [summary-name](https://dequeuniversity.com/rules/axe/4.12/summary-name?application=RuleDescription) | Ensure summary elements have discernible text | Serious | cat.name-role-value, wcag2a, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.4.1.2 | failure, needs&nbsp;review | |
74-
| [svg-img-alt](https://dequeuniversity.com/rules/axe/4.12/svg-img-alt?application=RuleDescription) | Ensure &lt;svg&gt; elements with an img, graphics-document or graphics-symbol role have accessible text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, ACT, RGAAv4, RGAA-1.1.5 | failure, needs&nbsp;review | [7d6734](https://act-rules.github.io/rules/7d6734) |
74+
| [svg-img-alt](https://dequeuniversity.com/rules/axe/4.12/svg-img-alt?application=RuleDescription) | Ensure &lt;svg&gt; elements with an img, image, graphics-document or graphics-symbol role have accessible text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, ACT, RGAAv4, RGAA-1.1.5 | failure, needs&nbsp;review | [7d6734](https://act-rules.github.io/rules/7d6734) |
7575
| [td-headers-attr](https://dequeuniversity.com/rules/axe/4.12/td-headers-attr?application=RuleDescription) | Ensure that each cell in a table that uses the headers attribute refers only to other &lt;th&gt; elements in that table | Serious | cat.tables, wcag2a, wcag131, section508, section508.22.g, TTv5, TT14.b, EN-301-549, EN-9.1.3.1, RGAAv4, RGAA-5.7.4 | failure, needs&nbsp;review | [a25f45](https://act-rules.github.io/rules/a25f45) |
7676
| [th-has-data-cells](https://dequeuniversity.com/rules/axe/4.12/th-has-data-cells?application=RuleDescription) | Ensure that &lt;th&gt; elements and elements with role=columnheader/rowheader have data cells they describe | Serious | cat.tables, wcag2a, wcag131, section508, section508.22.g, TTv5, TT14.b, EN-301-549, EN-9.1.3.1, RGAAv4, RGAA-5.7.1 | failure, needs&nbsp;review | [d0f69e](https://act-rules.github.io/rules/d0f69e) |
7777
| [valid-lang](https://dequeuniversity.com/rules/axe/4.12/valid-lang?application=RuleDescription) | Ensure lang attributes have valid values | Serious | cat.language, wcag2aa, wcag312, TTv5, TT11.b, EN-301-549, EN-9.3.1.2, ACT, RGAAv4, RGAA-8.8.1 | failure | [de46e4](https://act-rules.github.io/rules/de46e4) |

lib/rules/role-img-alt.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
],
2020
"actIds": ["23a2a8"],
2121
"metadata": {
22-
"description": "Ensure [role=\"img\"] elements have alternative text",
23-
"help": "[role=\"img\"] elements must have alternative text"
22+
"description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text",
23+
"help": "[role=\"img\"] and [role=\"image\"] elements must have alternative text"
2424
},
2525
"all": [],
2626
"any": ["aria-label", "aria-labelledby", "non-empty-title"],

lib/rules/svg-img-alt.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
],
2020
"actIds": ["7d6734"],
2121
"metadata": {
22-
"description": "Ensure <svg> elements with an img, graphics-document or graphics-symbol role have accessible text",
23-
"help": "<svg> elements with an img role must have alternative text"
22+
"description": "Ensure <svg> elements with an img, image, graphics-document or graphics-symbol role have accessible text",
23+
"help": "<svg> elements with an img or image role must have alternative text"
2424
},
2525
"all": [],
2626
"any": [

locales/_template.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@
354354
"help": "All page content should be contained by landmarks"
355355
},
356356
"role-img-alt": {
357-
"description": "Ensure [role=\"img\"] elements have alternative text",
358-
"help": "[role=\"img\"] elements must have alternative text"
357+
"description": "Ensure [role=\"img\"] and [role=\"image\"] elements have alternative text",
358+
"help": "[role=\"img\"] and [role=\"image\"] elements must have alternative text"
359359
},
360360
"scope-attr-valid": {
361361
"description": "Ensure the scope attribute is used correctly on tables",
@@ -382,8 +382,8 @@
382382
"help": "Summary elements must have discernible text"
383383
},
384384
"svg-img-alt": {
385-
"description": "Ensure <svg> elements with an img, graphics-document or graphics-symbol role have accessible text",
386-
"help": "<svg> elements with an img role must have alternative text"
385+
"description": "Ensure <svg> elements with an img, image, graphics-document or graphics-symbol role have accessible text",
386+
"help": "<svg> elements with an img or image role must have alternative text"
387387
},
388388
"tabindex": {
389389
"description": "Ensure tabindex attribute values are not greater than 0",

0 commit comments

Comments
 (0)