You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: reconcile native-interactive-elements via shared util
Adds `lib/utils/native-interactive-elements.js` exporting `isNativeInteractive(node, getTextAttrValue)` — the canonical "is this HTML tag natively interactive?" classifier. Migrates `template-no-invalid-interactive` and `template-no-nested-interactive` to use it.
## Decision table
The set is hand-curated because axobject-query disagrees with browser reality on several rows (notably audio/video unconditional-widget; <menuitem> deprecated-but-still-listed). Each row is documented inline with spec/browser rationale. See the JSDoc in `lib/utils/native-interactive-elements.js` for the full table.
Interactive set:
- `button`, `select`, `textarea`, `iframe`, `embed`, `summary`, `details` — universally accepted widgets (iframe/details deviate from axobject-query's type classification but are focusable in practice).
- `input` — except `type=hidden`.
- `option`, `datalist` — axobject-query widget (ListBoxOptionRole / ListBoxRole).
- `canvas` — axobject-query widget (CanvasRole); convention + no-false-positive bias.
- `a[href]`, `area[href]` — HTML-AAM: anchor interactivity requires href.
- `audio[controls]`, `video[controls]` — stricter than axobject-query (which marks bare audio/video as widget unconditionally); aligns with browser reality.
Not in the interactive set:
- `input[type=hidden]`, `menuitem`, `label` — documented per-row.
- `<object>` — excluded. Earlier revision included it based on a misattributed axobject-query EmbeddedObjectRole citation; verification showed that role maps only to `<embed>`, not `<object>`. With no authoritative source backing inclusion, default to non-interactive.
## Consumers
- `template-no-invalid-interactive` — replaces inline native-interactive set.
- `template-no-nested-interactive` — same.
Both rules' behavior is preserved for every case except `<object>` (no longer classified as interactive). Tests updated accordingly — `<object usemap=""><button>` no longer flagged as nested-interactive.
0 commit comments