fix(controller): index disabled dropdown options so the full list is visible - #648
fix(controller): index disabled dropdown options so the full list is visible#648zhang17-24 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e6b61d8a3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (tagName !== 'li' && tagName !== 'option' && !(role && DROPDOWN_OPTION_ROLES.has(role))) { | ||
| return false |
There was a problem hiding this comment.
Do not index ARIA wrapper list items
When a role="menu"/role="listbox" uses the common ARIA pattern of <li role="none"> wrappers around real role="menuitem" children, this condition still treats the wrapper li as an option because every li inside a dropdown container returns true before the normal role/cursor/disabled checks run. That gives both the non-actionable wrapper and the actual menu item numeric indexes, so the agent can choose an empty/no-op wrapper index and the simplified DOM is polluted with duplicate actions; consider excluding explicit non-option roles such as none/presentation/separator or only accepting bare lis for known dropdown item classes.
Useful? React with 👍 / 👎.
c896c34 to
7e6b61d
Compare
…visible Element UI / Avue selects commonly disable some options (cursor: not-allowed). `isInteractiveElement` treated them as non-interactive, so they never received a highlight index and the LLM could not see or select the intended option. Detect li/option elements inside dropdown/menu containers and index them even when visually disabled, keeping the complete option list in the simplified DOM.
7e6b61d to
8fffd2f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fffd2ff0f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (isDropdownOptionElement(element)) { | ||
| return true |
There was a problem hiding this comment.
Preserve disabled state for indexed options
When a dropdown item is disabled only by CSS/class, such as the Element UI case added in the new test with cursor:not-allowed/is-disabled, this early return runs before the cursor/disabled checks and the default simplified DOM does not include class or style. The prompt therefore exposes that disabled item as a normal [n]<li>... action, so the agent can keep trying an option the UI will reject instead of seeing it as unavailable; carry a disabled marker or emit the text without making it look actionable.
AGENTS.md reference: AGENTS.md:L150-L151
Useful? React with 👍 / 👎.
Summary
Element UI / Avue selects commonly disable some options (rendered with
cursor: not-allowed).isInteractiveElementtreated them as non-interactive, so disabled options never received a highlight index and disappeared from the simplified DOM. The LLM then could not see or select the intended option, makingselect_dropdown_optionunstable in common Element UI / Avue form scenarios (see #519).This PR detects
li/optionelements inside dropdown/menu containers ([role="listbox"],[role="menu"],select,.el-select-dropdown, ...) and keeps them indexable even when visually disabled, so the complete option list stays visible to the LLM.Changes
packages/page-controller/src/dom/dom_tree/index.js: add dropdown option detection (isDropdownOptionElement) and use it inisInteractiveElementpackages/page-controller/src/dom/dom_tree/dropdown-options.test.ts: new tests (happy-dom, nogetEventListeners— mirrors the real page-agent injection environment)Test plan
npm testinpackages/page-controllerpasses (7 tests)npm run typecheckand eslint passFixes #519