Repository navigation
fix(browser): own child tabs, make Tab move focus, #21 follow-ups - #22
Merged
Merged
Conversation
A target=_blank link or window.open popup the agent triggers now belongs to the task that triggered it: a tab whose opener is one of the task's tabs, created within 10 s of an agent click or key press there, joins the task's tabs and group and is closed by its cleanup. Tabs opened from an agent tab without a recent agent action stay the user's. (#14) browser_press_key Tab dispatched the keystroke, but Chrome runs focus traversal only in a focused page, and a background agent tab never is. Focus stayed put, the tool reported success, and the next browser_type landed in the original field. When the keystroke does not move focus and the page did not handle it, move focus to the next element in sequential focus order; report where focus went, and fail when it cannot move. (#20)
- Snapshot modal scoping kept only controls inside the dialog, so a select or combobox whose options render in a portal at the end of <body> (Radix, MUI, Headless UI) lost every option. Roots the modal's controls point at via aria-controls/aria-owns, open popovers, and controls painted on top of the modal stay in scope. - wait_for_selector refuses selectors that test the value attribute. React mirrors controlled inputs' values there, password fields included, so met/timeout answered a password one guessed character at a time. Escapes and comments are undone before the check. - null for an optional argument means absent again, as it did before offset/limit/wait_for_selector existed. - A transient evaluate error (a navigation destroying the context) polls again until the deadline instead of ending the wait. - When an extension older than the server ignores the new arguments, both hosts say so and ask for a reload instead of printing nothing. - The native-host relay exits on backend EOF on Linux too (#16): it blocks on Chrome's stdin the same way the Windows relay did. - e2e: click a prompt's button after the evaluation has answered, since the click closes the window; report the live targets when no prompt answers. - browser_click / browser_press_key / browser_close_all_tabs descriptions cover child tabs and Tab's focus report.
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.
Fixes #14. Fixes #20. Follow-ups to #21 and #17.
#14: tabs the agent's clicks open
A tab whose opener is one of a task's tabs, created within 10 s of an agent click or key press in that opener, becomes the task's tab. It joins the task's group (a popup window, which cannot be grouped, stays where it is) and the task's cleanup closes it. A tab opened from an agent tab without a recent agent action stays the user's.
#20: Tab in a background tab
Chrome runs focus traversal only in a focused page, and a background agent tab never is one. The keystroke reached the page, focus stayed put, and the next
browser_typewent into the original field. Now, if the keystroke does not move focus and the page did notpreventDefaultit, the extension moves focus to the next element in sequential focus order: positive tabindex first, a radio group counts as one stop, hidden/disabled/inert elements are skipped, and a text field's contents are selected as with a real Tab. The result names the focused element. If focus cannot move, the call fails instead of reporting success.Follow-ups to #21
aria-controls/aria-owns, open popovers, and controls painted on top of the modal.wait_for_selectorsuch asinput[type=password][value^="a"]returned met or timeout, which reveals a React-controlled password one character at a time. Selectors that test thevalueattribute are now refused, after undoing CSS escapes and comments.nullfor an optional argument means absent again.Verified locally
node chrome-extension/background.test.mjs: 56 passed.scripts/snapshot-dom.test.mjsagainst Chrome 155: all scenarios, including the new portal ones.scripts/e2e-browser.mjsagainst Chrome for Testing 155: 18/18, three runs.swift buildpasses.🤖 Generated with Claude Code