Add attach_tab() and new_tab(background=True) for focus-preserving automation#504
Open
icekinder wants to merge 1 commit into
Open
Add attach_tab() and new_tab(background=True) for focus-preserving automation#504icekinder wants to merge 1 commit into
icekinder wants to merge 1 commit into
Conversation
…tomation When the harness drives a user's live browser, new_tab()/switch_tab() activate the target and yank the user out of whatever tab they are working in. This adds: - attach_tab(target): attach a session without activating the tab (switch_tab() keeps its behavior and is now activate + attach_tab) - new_tab(url, background=True): create via Target.createTarget's background flag and attach without activating The reuse-a-blank-current-tab shortcut in new_tab() is skipped when background=True, since the current tab may be the user's visible one. Documented both in interaction-skills/tabs.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Skill review passedReviewed 1 file(s) — no findings. |
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.
Motivation
When the harness drives a user's live browser (the daemon attached to their real Chrome),
new_tab()andswitch_tab()activate the target — which visibly yanks the user out of whatever tab they're working in every time automation runs. For background/batch workflows (CSV imports, polling a web app's UI, scraping a logged-in dashboard) the automation has no reason to be visible at all.Changes
attach_tab(target)— attach a session to a tab without activating it.switch_tab()keeps its exact behavior and is now literally activate +attach_tab().new_tab(url, background=False)— withbackground=True, the tab is created viaTarget.createTarget'sbackgroundflag and only attached, never activated. Default behavior unchanged.new_tab()is skipped whenbackground=True: the current tab may be the user's visible one, andbackgroundis an explicit request not to touch what they see.interaction-skills/tabs.md(code block + a "rules that held up" line).Notes
Running this against a live daily-driver Chrome for a few weeks now — background CSV-import/enrichment runs no longer steal focus while the user keeps browsing.
🤖 Generated with Claude Code
Summary by cubic
Adds attach_tab() and new_tab(background=True) so automation can attach to tabs without activating them, preventing focus theft in a user’s live browser. Default behavior remains unchanged.
Written for commit 5702b58. Summary will update on new commits.