Skip to content

Commit bb754d8

Browse files
committed
refactor: align with #37's HTML-content-model authority split
Replace lib/utils/native-interactive-elements.js with lib/utils/html-interactive-content.js to match the canonical util introduced in #37. The new util cites HTML Living Standard §3.2.5.2.7 Interactive Content as its sole authority, resolving the previous mixed-authority approach that cited axobject-query's widget taxonomy for some rows and HTML spec for others. Byte-identical copy of #37's util + test across worktrees so the two PRs can land in either order without conflict.
1 parent 5cff172 commit bb754d8

5 files changed

Lines changed: 6 additions & 274 deletions

lib/rules/template-no-aria-hidden-on-focusable.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const { isComponentInvocation } = require('../utils/is-component-invocation');
4-
const { isNativeInteractive } = require('../utils/native-interactive-elements');
4+
const { isHtmlInteractiveContent } = require('../utils/html-interactive-content');
55

66
function findAttr(node, name) {
77
return node.attributes?.find((a) => a.name === name);
@@ -55,11 +55,11 @@ function isFocusable(node) {
5555
return true;
5656
}
5757

58-
// Delegate native-focusable classification to the shared util. It handles
59-
// button/select/textarea/iframe/embed/summary/details/option/datalist/
60-
// object/canvas, input (non-hidden), a[href]/area[href], and
58+
// Delegate interactive-content classification to the shared util (HTML
59+
// §3.2.5.2.7 + summary): button/details/embed/iframe/label/select/summary/
60+
// textarea, input (non-hidden), a[href], img[usemap], and
6161
// audio[controls]/video[controls].
62-
return isNativeInteractive(node, getTextAttrValue);
62+
return isHtmlInteractiveContent(node, getTextAttrValue);
6363
}
6464

6565
// A focusable descendant of an aria-hidden="true" ancestor can still receive

lib/utils/html-interactive-content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function isHtmlInteractiveContent(node, getTextAttrValue, options = {}) {
6363
// input — interactive unless type="hidden"
6464
if (tag === 'input') {
6565
const type = getTextAttrValue(node, 'type');
66-
return type === undefined || type === null || type.trim().toLowerCase() !== 'hidden';
66+
return type !== 'hidden';
6767
}
6868

6969
// a — interactive only when href is present

lib/utils/native-interactive-elements.js

Lines changed: 0 additions & 89 deletions
This file was deleted.

tests/lib/utils/html-interactive-content-test.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,6 @@ describe('isHtmlInteractiveContent', () => {
5353
isHtmlInteractiveContent(makeNode('input', { type: 'hidden' }), getTextAttrValue)
5454
).toBe(false);
5555
});
56-
57-
it('is NOT interactive when type="HIDDEN" (case-insensitive)', () => {
58-
expect(
59-
isHtmlInteractiveContent(makeNode('input', { type: 'HIDDEN' }), getTextAttrValue)
60-
).toBe(false);
61-
});
62-
63-
it('is NOT interactive when type=" hidden " (whitespace-trimmed)', () => {
64-
expect(
65-
isHtmlInteractiveContent(makeNode('input', { type: ' hidden ' }), getTextAttrValue)
66-
).toBe(false);
67-
});
6856
});
6957

7058
describe('<a>', () => {

tests/lib/utils/native-interactive-elements-test.js

Lines changed: 0 additions & 167 deletions
This file was deleted.

0 commit comments

Comments
 (0)