fix: recognize role="listitem" as interactive element#203
Open
Lubrsy706 wants to merge 1 commit intoalibaba:mainfrom
Open
fix: recognize role="listitem" as interactive element#203Lubrsy706 wants to merge 1 commit intoalibaba:mainfrom
Lubrsy706 wants to merge 1 commit intoalibaba:mainfrom
Conversation
Add `listitem` to both `interactiveRoles` and `INTERACTIVE_ROLES` sets so that elements with `role="listitem"` (e.g. Quasar Framework's q-item components) are detected as individually interactive and highlighted separately, instead of being collapsed into their parent menu container. Closes alibaba#193 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #193
Elements with
role="listitem"(used by Quasar Framework'sq-itemcomponents and other UI libraries) were not recognized as individually interactive. Instead, only the parent menu/list container was highlighted as a single interactive element, making it impossible for the LLM to click individual list items.Root Cause
role="listitem"was missing from two role sets:interactiveRolesinisInteractiveElement()— elements with this role were not detected as interactive (unless caught by cursor:pointer heuristic)INTERACTIVE_ROLESinisElementDistinctInteraction()— even if detected as interactive, these elements were not considered "distinct" from their parent, so they were skipped when the parent container was already highlightedFix
Add
'listitem'to both sets. This ensures:isInteractiveElement()recognizesrole="listitem"elements as interactiveisElementDistinctInteraction()treats them as independent interactions (not collapsed into parent)Quasar Example
[0]<div role="menu">was highlighted — individual items invisible to LLM[0]<div role="listitem">Registration,[1]<div role="listitem">Change of Registeredhighlighted separatelyTest Plan
npm run buildpassesnpm run lintpassesrole="listitem"items are individually highlighted🤖 Generated with Claude Code