Skip to content

fix(mcp): don't activate tabs on the client's behalf in extension mode - #43659

Closed
Ari Mendelow (arimendelow) wants to merge 1 commit into
microsoft:mainfrom
ourostack:user/arimendelow/no-focus-2-no-activate
Closed

Ari Mendelow (arimendelow) wants to merge 1 commit into
microsoft:mainfrom
ourostack:user/arimendelow/no-focus-2-no-activate

Conversation

@arimendelow

@arimendelow Ari Mendelow (arimendelow) commented Oct 27, 2026 •

Copy link
Copy Markdown

Part of #43657. Merge after #43658: without its focus emulation, a selected tab that stays hidden would not take clicks.

In extension mode, the browser is the user's own. browser_tabs select currently calls page.bringToFront(), which activates the tab in the user's window and can bring the window forward. With this change, Context.selectTab skips bringToFront() when the tool runs in extension mode, and logs that it did so under pw:mcp:test. The selected tab becomes the client's current tab and keeps working in the background.

browser_start_recording still brings its tab to front, because the user has to act in that tab. Explicit calls are unchanged: the relay still forwards a client's own page.bringToFront().

Whether this should be the default is a policy question for the issue. The alternative is an option, for example --no-activate-tabs.

Tests (tests/extension/no-activate.spec.ts):

  • browser_tabs select leaves the user's tab active.
  • browser_start_recording makes the recorded tab active.

The select test fails on upstream main; the recording test passes there, because main already brings the recorded tab to front (CI run).

In extension mode the browser is the user's own. Selecting a tab with
browser_tabs no longer brings it to front, so the user's active tab and
window stay as they are; the selected tab keeps working in the
background. browser_start_recording still brings its tab to front,
because the user has to act in it.
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

5189 passed, 614 skipped


Merge workflow run.

@dgozman

Copy link
Copy Markdown
Collaborator

I'll close this until we arrive to a product decision on the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants