Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix(bridge): open new tabs in background to stop foreground focus-steal

Cody Arnold01795a8529bd
diff --git a/internal/bridge/tab_manager.go b/internal/bridge/tab_manager.go
index b724e4c7..1563765a 100644
--- a/internal/bridge/tab_manager.go
+++ b/internal/bridge/tab_manager.go
@@ -162,12 +162,16 @@ func (tm *TabManager) CreateTab(url string) (string, context.Context, context.Ca
}
// target.CreateTarget works for both local and remote (CDP_URL) allocators.
+ // WithBackground(true): open the new tab WITHOUT raising/activating the
+ // browser window, so automation never steals the operator's foreground
+ // focus. The browser stays fully visible (non-headless) -- only the
+ // focus-grab is suppressed. (newWindow stays false, which background requires.)
var targetID target.ID
createCtx, createCancel := context.WithTimeout(tm.browserCtx, tabCreateTimeout)
if err := chromedp.Run(createCtx,
chromedp.ActionFunc(func(ctx context.Context) error {
var err error
- targetID, err = target.CreateTarget("about:blank").Do(ctx)
+ targetID, err = target.CreateTarget("about:blank").WithBackground(true).Do(ctx)
return err
}),
); err != nil {