fix(input): stop native select option clicks from timing out#1960
Open
cooleryu wants to merge 1 commit intoChromeDevTools:mainfrom
Open
fix(input): stop native select option clicks from timing out#1960cooleryu wants to merge 1 commit intoChromeDevTools:mainfrom
cooleryu wants to merge 1 commit intoChromeDevTools:mainfrom
Conversation
|
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. |
0b7142a to
24b53c7
Compare
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
Teach the
clicktool to handle accessibility snapshot targets that point at anoptioninside a native, single-select<select>element.When the target is a native select option,
clicknow 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 callclickon 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
filltool already handles selecting native<select>options. This change keeps that guidance explicit in theclicktool description, while also makingclick(option_uid)robust for the native select case that appears in the snapshot.Changes
click:option.HTMLOptionElementnodes owned by a native<select>.inputandchangeevents when selecting a different native option.clicktool description to steer agents towardfillfor native<select>option selection.npm run gen.<select>.<optgroup>.role="option"element through the normal click path.Test Plan
Passed:
npm run test -- tests/tools/input.test.ts npm run check-formatAlso attempted:
npm run testThe 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.captureScreenshotfailed for the large full-page screenshot case withPage is too large.The changed input tool tests pass locally.
Risk
Low. The fallback is intentionally narrow:
option.HTMLOptionElement.<select>controls.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
clickinto a general custom dropdown heuristic.The tool description still recommends
fillfor 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.