Skip to content

Cmd-W with a plugin's inner pane focused closes the whole bb window: plugins have no way to join the close-window-or-side-tab arbitration #4590

Open

Description

@cristoslc

The workflow

A plugin app renders its own side pane for a thread (a "pane inside the plugin view"). With the pane open, the operator presses Cmd-W / Ctrl-W — the same gesture bb's menu binds to "Close Window or Side Tab" — expecting the innermost focused surface to close, falling back outward (pane → plugin tab → window).

What happens today — observed

With bb desktop 0.44.0 (macOS), a plugin app view open, the plugin's inner thread pane open, and the caret in the pane's composer: pressing Cmd-W closed the entire bb desktop window. The plugin never got a chance to claim the chord.

Why, from the code at 0baa605b32a00619c1d7e3f32be6553ebcf8244a (= tag desktop-v0.44.0): panel.close is registered in the application menu with CommandOrControl+W (desktop-menu-shortcuts.ts L16–18, resolved from user keybindings at L92); its click path goes to requestRendererWindowClose (main.ts L696, wired at L917, which asks the renderer and force-closes the window if nobody claims it. Built-in hosts claim it via useAppCommandHandler("panel.close", …) / desktopInfo.onCloseWindowRequest (RootComposePanelCommandHandlers.tsx L21–29, exposed by preload.ts L437/L497) — but the plugin SDK does not: packages/plugin-sdk/src/app-contract.ts at the same commit exposes neither onCloseWindowRequest nor a panel.close registration. So a plugin page with an open inner surface leaves the close-request unclaimed, and the window closes. A DOM-level Cmd-W listener in the plugin is not a workaround: the menu accelerator consumes the key before the page sees it (also confirmed by the window closing while the plugin's listener was armed).

Steps to reproduce

  1. bb desktop 0.44.0, macOS.
  2. Open a plugin app view that renders its own inner side pane (e.g. focus-board's thread pane).
  3. Open the inner pane.
  4. Focus the pane (caret in its composer).
  5. Press Cmd-W.
  6. Actual: the whole bb window closes. Expected: the inner pane closes.

What we would expect

Plugins join the close arbitration the built-in hosts have: expose onCloseWindowRequest (or a panel.close handler registration) to plugin frontends through the SDK, so a plugin's focused inner surface can claim the chord via the existing close-request/response handshake, falling through to the plugin tab or window when it reports unhandled.

Context and alternatives

Affects every plugin that renders its own closeable sub-surface inside a plugin view: today one accidental Cmd-W discards the entire session window (all panes, all surfaces), not just the focused surface. No SDK workaround exists. Partial mitigation (DOM keydown listener) is inert in the desktop shell for the reason above. Related, different root cause: #3184 (embedded-browser focus). Not a duplicate: searched open+closed issues for plugin Cmd-W, panel.close from plugins, onCloseWindowRequest. Suggested priority: medium (one chord throws away the whole window's state; hit on every plugin with an inner pane); effort: SDK surface + preload plumbing.

Evidence trail / discussion thread: bb thread thr_iiikw3hdpb.

AGENT GENERATED

Activity

  1. added theissue type on Oct 1, 2026
  2. added
    plugins
    desktop
    partial-repro
    on Oct 1, 2026
  3. bb-slop-cop commented on Oct 1, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Medium. Applied labels: plugins, desktop, partial-repro.
    • Report: https://get-bb.github.io/reports/issues/4590.html
    • Verdict: PARTIALLY REPRODUCED · Root-cause confidence: high for the SDK/desktop IPC gap; the native macOS gesture remains unverified.
    • Root cause: Desktop close requests dispatch only desktop listeners, not plugin SDK commands. An unclaimed request reaches the window-close fallback.
    • Evidence: Two clean trusted-main checkouts return handled: false with the plugin callback untouched; the built-in listener control passes. Eight existing focused desktop tests also pass.
    • No PR: A safe fix needs a public SDK close-arbitration contract and focus-ordering design, outside the simple-fix gate.

    AGENT GENERATED

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

    desktoppartial-reproplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions