Skip to content

fix(controller): index disabled dropdown options so the full list is visible - #648

Open
zhang17-24 wants to merge 1 commit into
alibaba:mainfrom
zhang17-24:fix/519-disabled-dropdown-options
Open

fix(controller): index disabled dropdown options so the full list is visible#648
zhang17-24 wants to merge 1 commit into
alibaba:mainfrom
zhang17-24:fix/519-disabled-dropdown-options

Conversation

@zhang17-24

Copy link
Copy Markdown

Summary

Element UI / Avue selects commonly disable some options (rendered with cursor: not-allowed). isInteractiveElement treated 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, making select_dropdown_option unstable in common Element UI / Avue form scenarios (see #519).

This PR detects li/option elements 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 in isInteractiveElement
  • packages/page-controller/src/dom/dom_tree/dropdown-options.test.ts: new tests (happy-dom, no getEventListeners — mirrors the real page-agent injection environment)

Test plan

  • npm test in packages/page-controller passes (7 tests)
  • Verified in a real browser against an Element UI 2.x select with disabled options: all 6 options now get indexes
  • npm run typecheck and eslint pass

Fixes #519

@CLAassistant

CLAassistant commented Aug 1, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +717 to +718
if (tagName !== 'li' && tagName !== 'option' && !(role && DROPDOWN_OPTION_ROLES.has(role))) {
return false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@zhang17-24
zhang17-24 force-pushed the fix/519-disabled-dropdown-options branch from c896c34 to 7e6b61d Compare August 1, 2026 06:45
…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.
@zhang17-24
zhang17-24 force-pushed the fix/519-disabled-dropdown-options branch from 7e6b61d to 8fffd2f Compare August 1, 2026 06:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +752 to +753
if (isDropdownOptionElement(element)) {
return true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Element UI / Avue dropdown options are partially indexed when appended to body

2 participants