Repository navigation
docs: pick a native select in Chrome with one desktop_key call - #139
Merged
Merged
Conversation
…t picking a native select in Chrome Closes #138.
…ct in one desktop_key call Live checks showed background keys do reach Chrome; the select's menu closing between calls is the real cause.
This was referenced Oct 19, 2026
Merged
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.
Closes #138.
Summary
The real cause is that a Chromium
<select>menu closes between tool calls. Clicking an item or usingAXPickfrom a later snapshot therefore goes stale (SNAPSHOT_STALE). The fix is to pick with onedesktop_keycall while the select has keyboard focus:keys: [down (opens the menu), down × n, enter], where n is the target option's index minus the current option's index. This works in the background.docs/recipes.md: new recipe "Pick from a native select in a browser". It covers focusing the select (Tab, or a click, which also opens the menu), counting n from the options an open menu lists, the single key call, and reading back theAXPopUpButtonvalue.desktop_activateis mentioned only as a fallback when the value didn't change. Separators and disabled items are marked (unverified). The web form recipe step now points Chromium browsers to the new recipe.docs/tools.mdand thedesktop_set_value/desktop_element_actiondescriptions insrc/tools.tskeep click +AXPickfor native pop-up buttons and point Chromium<select>to the singledesktop_keycall.[Unreleased]entry.An earlier revision downgraded
desktop_keytounknownfor background Chromium apps. Live checks disproved that premise, so it was removed. There are no code or native changes now, only docs and tool descriptions.Live evidence
Setup: isolated Chrome, a local page with an
<input>and a<select>, Chrome in the background with Preview frontmost, installed host 0.14.1.desktop_keyx×3 into a focused Chrome text input: the keys landed (xxx). The Fill password fields: from the Keychain by reference, or agent-supplied text with approval #117 spike also saw background keys land in a Chrome password field.desktop_keywith keys[tab, down]: focus moved to the select and its menu opened (AXMenuplus 5AXMenuItems in the next snapshot).desktop_element_actionAXPickon an item from that snapshot: refused withSNAPSHOT_STALE, which reproduces the issue. The next inspect showed the menu had closed by itself, and the select kept focus.desktop_keycall with keys[down, down, down, down, enter]: the select'sAXPopUpButtonvalue read back "English (U.S.)" (the 4th item). Chrome never came forward.Testing
npm testandnpm run checkpass.Follow-up
desktop_choosetool, or extendingdesktop_select, forAXPopUpButton: open the menu, find the item by title, and pick it in one call. This is out of scope here.