Skip to content

Commit 8ec2dc9

Browse files
Merge pull request #2721 from johanrd/refactor/abstract-roles-from-aria-query
refactor(template-no-abstract-roles): source abstract-role list from aria-query
2 parents e81aeb2 + d70a2b6 commit 8ec2dc9

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

lib/rules/template-no-abstract-roles.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
const PROHIBITED_ROLE_VALUES = new Set([
2-
'command',
3-
'composite',
4-
'input',
5-
'landmark',
6-
'range',
7-
'roletype',
8-
'section',
9-
'sectionhead',
10-
'select',
11-
'structure',
12-
'widget',
13-
'window',
14-
]);
1+
const { roles } = require('aria-query');
2+
3+
// Abstract ARIA roles, sourced from aria-query. Abstract roles exist only for
4+
// taxonomy — authors should never set role="widget" / "landmark" / etc.
5+
// https://www.w3.org/TR/wai-aria-1.2/#abstract_roles
6+
const PROHIBITED_ROLE_VALUES = new Set(
7+
[...roles.keys()].filter((role) => roles.get(role).abstract)
8+
);
159

1610
/** @type {import('eslint').Rule.RuleModule} */
1711
module.exports = {

0 commit comments

Comments
 (0)