Repository navigation
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
Closed
Ari Mendelow (arimendelow) wants to merge 1 commit into
Ari Mendelow (arimendelow) wants to merge 1 commit into
Conversation
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.
Contributor
Test results for "MCP"5189 passed, 614 skipped Merge workflow run. |
Collaborator
|
I'll close this until we arrive to a product decision on the issue. |
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.
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_tabsselectcurrently callspage.bringToFront(), which activates the tab in the user's window and can bring the window forward. With this change,Context.selectTabskipsbringToFront()when the tool runs in extension mode, and logs that it did so underpw:mcp:test. The selected tab becomes the client's current tab and keeps working in the background.browser_start_recordingstill 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 ownpage.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 selectleaves the user's tab active.browser_start_recordingmakes the recorded tab active.The
selecttest fails on upstream main; the recording test passes there, because main already brings the recorded tab to front (CI run).