Skip to content

Agent clicks on _blank links in the Browser panel can steal composer focus #29009

Open

Description

@t3dotgg

When an agent clicks a target="_blank" link in a desktop-hosted Browser tab, the composer can lose keyboard focus. This also happens when the agent works in another thread.

Path: apps/desktop/src/preview/Manager.ts window open handler (foreground-tab) → emitOpenLink → web openLinkInPreview (apps/web/src/browser/ElectronBrowserHost.tsx) → openUrlInPreview → openBrowser. openBrowser is a user action, so startWorkspaceFocus (apps/web/src/lib/workspaceFocus.ts) requests panel focus.

The desktop does not tell the web whether the click came from the agent or the user. Two options:

  • Open the tab in the background when the click came from the agent.
  • Make startWorkspaceFocus request panel focus only for the thread on screen. This closes the cross-thread part.

Found during review of #28613.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions