Skip to content

fix: add option to disable focused page emulation#2271

Open
samiralibabic wants to merge 3 commits into
ChromeDevTools:mainfrom
samiralibabic:fix/no-emulate-focused-pages
Open

fix: add option to disable focused page emulation#2271
samiralibabic wants to merge 3 commits into
ChromeDevTools:mainfrom
samiralibabic:fix/no-emulate-focused-pages

Conversation

@samiralibabic

@samiralibabic samiralibabic commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • Adds --emulate-focused-pages / --no-emulate-focused-pages so users can opt out of passive focused-page emulation during page snapshot setup.
  • Forwards the background option when creating pages in isolated contexts.
  • Documents the new CLI option in README.md.

Scope

This intentionally does not suppress explicit activation requests such as select_page with bringToFront: true.

The option only controls passive focused-page emulation from createPagesSnapshot().

Focused-page emulation remains enabled by default to preserve existing behavior for multi-agent workflows where pages should behave as focused/active. Disable it only when visible-browser focus behavior is problematic.

Validation

  • npm run build
  • npm run test:no-build -- tests/cli.test.ts tests/McpContext.test.ts
  • npm run test:no-build -- --test-name-pattern=isolatedContext tests/tools/pages.test.ts
  • npm run check-format

@google-cla

google-cla Bot commented Jun 29, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@samiralibabic samiralibabic changed the title Add option to disable focused page emulation fix: add option to disable focused page emulation Jun 29, 2026
@samiralibabic samiralibabic marked this pull request as ready for review June 29, 2026 21:28
@zyzyzyryxy

Copy link
Copy Markdown
Contributor

Thank you for your contribution!
We'd like to understand your case better before deciding on this PR. Please file a feature request issue and describe in detail in what scenario emulating a focused page is problematic. We'll follow up with questions there if needed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants