Skip to content

Commit 187c89b

Browse files
committed
refactor: remove tooltip from INTERACTIVE_ROLES per WAI-ARIA 1.2 §5.3.3
Per WAI-ARIA 1.2 §5.3.3 — Document Structure Roles: https://www.w3.org/TR/wai-aria-1.2/#tooltip Tooltip is explicitly listed under document-structure roles (alongside img, note, paragraph, etc.), not widget roles. The spec notes: 'Document structures are not usually interactive.' jsx-a11y and lit-a11y agree — neither adds tooltip to their interactive- role set (both add only toolbar). The one test case expecting tooltip to be treated as interactive moves accordingly. aria-query's superClass for tooltip is structure/section, which the narrow widget-ancestor filter correctly excludes.
1 parent c6fb02f commit 187c89b

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/utils/interactive-roles.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ const { roles } = require('aria-query');
1010
// aria-query's taxonomy, but supports `aria-activedescendant` and is widget-
1111
// like in practice. jsx-a11y and lit-a11y add it for the same reason.
1212
//
13-
// `tooltip` is also addedARIA 1.2 doesn't cleanly categorize tooltip under
14-
// the widget taxonomy (aria-query's superClass is `structure/section`), but
15-
// tooltips with interactive content (close buttons, links) are common and our
16-
// existing test suite treats them as interactive.
13+
// `tooltip` is intentionally NOT added. Per WAI-ARIA 1.2 §5.3.3 — Document
14+
// Structure Roles (https://www.w3.org/TR/wai-aria-1.2/#tooltip), tooltip is
15+
// a document-structure role, not a widget; the spec says "document structures
16+
// are not usually interactive." jsx-a11y and lit-a11y agree.
1717
module.exports.INTERACTIVE_ROLES = buildInteractiveRoleSet();
1818

1919
function buildInteractiveRoleSet() {
20-
const result = new Set(['toolbar', 'tooltip']);
20+
const result = new Set(['toolbar']);
2121
for (const [role, def] of roles) {
2222
if (def.abstract) {
2323
continue;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ ruleTester.run('template-no-invalid-interactive', rule, {
6666
// <summary> is natively interactive
6767
'<template><summary onclick={{this.toggle}}>Details</summary></template>',
6868

69-
// ARIA widget roles: scrollbar, tooltip, treeitem
69+
// ARIA widget roles: scrollbar, treeitem
70+
// (tooltip is not a widget per WAI-ARIA 1.2 §5.3.3 — document-structure role)
7071
'<template><div role="scrollbar" onclick={{this.scroll}}>Scroll</div></template>',
71-
'<template><div role="tooltip" onclick={{this.show}}>Tip</div></template>',
7272
'<template><div role="treeitem" onclick={{this.select}}>Node</div></template>',
7373

7474
// audio/video with controls are interactive

0 commit comments

Comments
 (0)