Skip to content

fix(input): stop native select option clicks from timing out#1960

Open
cooleryu wants to merge 1 commit intoChromeDevTools:mainfrom
cooleryu:fix-click-native-select-option
Open

fix(input): stop native select option clicks from timing out#1960
cooleryu wants to merge 1 commit intoChromeDevTools:mainfrom
cooleryu:fix-click-native-select-option

Conversation

@cooleryu
Copy link
Copy Markdown

Summary

Teach the click tool to handle accessibility snapshot targets that point at an option inside a native, single-select <select> element.

When the target is a native select option, click now selects that option through the owning <select> element instead of asking Puppeteer to click an option node that has no clickable box while the dropdown is collapsed. Other option-like targets, including custom ARIA options, continue through the normal click path.

Motivation

Fixes #1941.

The text snapshot can expose native <option> nodes with stable uids. This makes it natural for an agent to call click on an option uid after seeing the desired option in the snapshot.

However, a collapsed native <select> does not expose its child <option> nodes as directly clickable page boxes. In that state, the option can exist in the DOM and accessibility tree while still having no clickable geometry. Puppeteer therefore waits for the option to become interactive and eventually times out.

The existing fill tool already handles selecting native <select> options. This change keeps that guidance explicit in the click tool description, while also making click(option_uid) robust for the native select case that appears in the snapshot.

Changes

  • Added a constrained native select fallback in click:
    • Only runs for single-click requests.
    • Only runs when the snapshot node role is option.
    • Only handles real HTMLOptionElement nodes owned by a native <select>.
    • Does not handle disabled selects, disabled options, disabled optgroups, or multi-selects.
    • Falls back to the existing locator click behavior for all other targets.
  • Dispatches input and change events when selecting a different native option.
  • Updated the click tool description to steer agents toward fill for native <select> option selection.
  • Regenerated CLI/tool reference docs with npm run gen.
  • Added regression coverage for:
    • Clicking an option uid in a collapsed native <select>.
    • Clicking an option uid inside a native <optgroup>.
    • Clicking a custom ARIA role="option" element through the normal click path.

Test Plan

Passed:

npm run test -- tests/tools/input.test.ts
npm run check-format

Also attempted:

npm run test

The full suite hit unrelated local failures outside this change area:

  • tests/tools/network.test.ts: snapshot ordering difference for redirected requests.
  • tests/tools/screenshot.test.ts: Page.captureScreenshot failed for the large full-page screenshot case with Page is too large.

The changed input tool tests pass locally.

Risk

Low. The fallback is intentionally narrow:

  • It is gated by the accessibility role being option.
  • It verifies the DOM node is an actual HTMLOptionElement.
  • It only applies to native, non-disabled, single-select <select> controls.
  • It does not reinterpret custom combobox/listbox implementations.
  • It preserves the existing locator click path for non-native option targets.

The main behavior change is that click(option_uid) can now succeed for native collapsed dropdowns that previously timed out.

Related Issue

Closes #1941.

Maintainer Context

This targets a small but high-impact mismatch between the snapshot representation and browser interaction semantics.

The snapshot correctly exposes native options because they exist in the accessibility tree. The click implementation previously treated that uid like any other clickable element, but collapsed native options do not have normal clickable layout boxes. This PR makes the native select case explicit without expanding click into a general custom dropdown heuristic.

The tool description still recommends fill for native <select> selection so agents are guided toward the more direct tool. The code fallback exists for the common case where an agent already selected an option uid from the snapshot.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 26, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@cooleryu cooleryu force-pushed the fix-click-native-select-option branch from 0b7142a to 24b53c7 Compare April 26, 2026 12:02
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.

click tool cannot be used to choose an option from dropdown <select>

1 participant