Skip to content

Commit ad4db80

Browse files
committed
fix(template-no-invalid-role): drop unsupported ARIA 1.3 allowlist tokens
`associationlist`, `associationlistitemkey`, and `associationlistitemvalue` are not present in the current WAI-ARIA 1.3 editor's draft (https://w3c.github.io/aria/). Earlier commit listed all five as draft tokens; only `comment` and `suggestion` are actually proposed. Drop the three phantom tokens and the tests that accepted them as valid. With this change the rule now correctly flags `role='associationlist'` and siblings as invalid, matching peer behavior (jsx-a11y, vue-a11y, lit-a11y all reject them).
1 parent 5378fa1 commit ad4db80

2 files changed

Lines changed: 4 additions & 15 deletions

File tree

lib/rules/template-no-invalid-role.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
const { roles } = require('aria-query');
22

33
// Valid ARIA roles = concrete (non-abstract) entries from aria-query, plus a
4-
// small set of WAI-ARIA 1.3 draft roles that aria-query doesn't yet ship. The
4+
// couple of WAI-ARIA 1.3 draft roles that aria-query doesn't yet ship. The
55
// ARIA 1.2 base roles, DPUB-ARIA (doc-*), and Graphics-ARIA (graphics-*) all
6-
// come from aria-query.
7-
const ARIA_13_DRAFT_ROLES = [
8-
'associationlist',
9-
'associationlistitemkey',
10-
'associationlistitemvalue',
11-
'comment',
12-
'suggestion',
13-
];
6+
// come from aria-query. Both `comment` and `suggestion` are present in the
7+
// current ARIA 1.3 editor's draft (https://w3c.github.io/aria/).
8+
const ARIA_13_DRAFT_ROLES = ['comment', 'suggestion'];
149
const VALID_ROLES = new Set([
1510
...[...roles.keys()].filter((role) => !roles.get(role).abstract),
1611
...ARIA_13_DRAFT_ROLES,

tests/lib/rules/template-no-invalid-role.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ ruleTester.run('template-no-invalid-role', rule, {
5757
'<template><table role="textbox"></table></template>',
5858
'<template><div role="{{if this.inModal "dialog" "contentinfo" }}"></div></template>',
5959

60-
// Missing VALID_ROLES entries: associationlistitemkey, associationlistitemvalue, cell
61-
'<template><div role="associationlistitemkey">Key</div></template>',
62-
'<template><div role="associationlistitemvalue">Value</div></template>',
6360
'<template><td role="cell">Data</td></template>',
6461

6562
// Case-insensitive role matching
@@ -246,9 +243,6 @@ hbsRuleTester.run('template-no-invalid-role', rule, {
246243
'<AwesomeThing role="presentation"></AwesomeThing>',
247244
'<table role="textbox"></table>',
248245
'<div role="{{if this.inModal "dialog" "contentinfo" }}"></div>',
249-
// Missing VALID_ROLES entries: associationlistitemkey, associationlistitemvalue, cell
250-
'<div role="associationlistitemkey">Key</div>',
251-
'<div role="associationlistitemvalue">Value</div>',
252246
'<td role="cell">Data</td>',
253247
// Case-insensitive role matching
254248
'<div role="Button">Click</div>',

0 commit comments

Comments
 (0)