fix: recognize role="listitem" as interactive element (#203)

* fix: recognize role="listitem" as interactive element
* fix: DISTINCT_INTERACTIVE_ROLES

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Simon <10131203+gaomeng1900@users.noreply.github.com>
This commit is contained in:
Lubrsy
2026-04-03 20:09:48 +08:00
committed by GitHub
parent 68cee4cc64
commit 148bdb6839

View File

@@ -1218,8 +1218,9 @@ export default (
'details', 'details',
'label', 'label',
'option', 'option',
'li',
]) ])
const INTERACTIVE_ROLES = new Set([ const DISTINCT_INTERACTIVE_ROLES = new Set([
'button', 'button',
'link', 'link',
'menuitem', 'menuitem',
@@ -1235,6 +1236,9 @@ export default (
'searchbox', 'searchbox',
'textbox', 'textbox',
'listbox', 'listbox',
'listitem',
'treeitem',
'row',
'option', 'option',
'scrollbar', 'scrollbar',
]) ])
@@ -1311,7 +1315,7 @@ export default (
return true return true
} }
// Check interactive roles // Check interactive roles
if (role && INTERACTIVE_ROLES.has(role)) { if (role && DISTINCT_INTERACTIVE_ROLES.has(role)) {
return true return true
} }
// Check contenteditable // Check contenteditable