Skip to content

Prevent app chrome from being included in text selection #1440

Closed

Description

@ariofrio

Problem

In the desktop app, pressing Cmd-A while focus is outside an editable field selects text throughout the interface, including sidebar items, buttons, dialog labels, and other app chrome. Clicking and dragging can likewise create selections across the sidebar, the area below the composer, and other non-content surfaces.

This makes the interface behave like a document rather than a desktop application and can obscure which text is actually intended to be copied.

Reproduction

  1. Open the desktop app.
  2. Click the sidebar, an empty area of the app shell, or the area below the composer.
  3. Press Cmd-A.
  4. Observe interface labels and controls becoming selected.
  5. Alternatively, drag across the sidebar or another non-content surface and observe the same selection behavior.

Expected behavior

  • App chrome, controls, navigation labels, and empty layout surfaces do not participate in native text selection.
  • Inputs, textareas, and contenteditable editors retain their normal native selection behavior.
  • User-authored and diagnostic content remains selectable, including messages, Markdown, file previews, diffs, terminal and tool output, logs, plugin panels, and displayed commands.
  • Cmd-A after pointer or keyboard interaction with a declared reading surface selects that surface rather than unrelated panes.
  • Commands intended for copying, such as the install.sh command in the Add Machine dialog, remain selectable.
  • Portaled reading surfaces can declare the same Select All boundary without making generic portal infrastructure selectable.

Acceptance criteria

  • Cmd-A from the app shell does not select sidebar or interface text.
  • Dragging across app chrome does not create a text selection.
  • Cmd-A in an input or editor selects that control's content normally.
  • Drag-selectable text and Cmd-A scopes are separate opt-ins: .select-text does not implicitly create a keyboard scope.
  • Cmd-A in a declared content scope selects the nearest active scope, excludes unrelated panes and nested controls, and does not cross an inline editor draft.
  • Each supported open-shadow reading surface maps Select All to one browser-representable selection root; interaction with light-DOM padding around a shadow-only viewer still selects its visible shadow content.
  • Select All routing is centralized. Editable targets retain native handling, non-editing controls retain their nearest declared reading scope, and active-scope tracking does not mutate DOM attributes or styles.
  • The desktop Edit menu routes Select All through the same renderer policy for application windows while retaining native Select All in browser and DevTools web contents.

Related pull request: #1428

Written by Codex

AGENT GENERATED: by GPT-5 Codex

Activity

  1. added theissue type on Aug 13, 2026
  2. added
    ui
    on Aug 18, 2026
  3. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1440.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): apps/app/src/app.css sets no user-select policy at all, so every element keeps the browser default (auto) and sidebar labels, header, composer footer and hidden a11y labels all join drag selections and Ctrl/Cmd-A; only ad-hoc select-none on drag handles/menu items exists.
    • Linked PR review: Prevent text selection in app chrome and non-content controls #1428 → REQUEST CHANGES — body.bb-app-shell{user-select:none} + leaf-level select-text opt-ins fixes the headline symptoms but regresses two things measured live in Chromium: a drag starting in the empty gutter beside a message no longer selects anything (works on main), and Ctrl-A on the thread paints all messages highlight
    • Proposed fix: Keep a shell-level policy in app.css (body none, editors forced to text) but make the opt-in boundary the content column (timeline scroll container incl. gutters, with tool headers/action bars set select-none inside it) instead of each prose leaf, so gutter drags and multi-message drags keep working; extend opt-in to diagnostic values (Info panel directory/branch/git status, thread title, settings ids/errors, toasts); add a real-browser (Playwright) test for gutter drag, Cmd-A+Cmd-C on content, Cmd-A from sidebar, Cmd-A in editor. The Cmd-A collapse (Blink SelectAll when the last selectable co…
    • Caveats: Repro and PR probes were done in headless Chromium 145 (Playwright) against the web app, not the Electron desktop shell; same Blink engine and same index.html/app.css, but not verified in Electron or on macOS Cmd-A. iOS Safari behavior of the PR was not tested. The exact Blink mechanism behind the empty Select All is inferred empirically (cases B/N vs T in db-minimal-chromium5.out), not from Blink…

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Opus 5

  4. added
    confirmed-repro
    on Aug 18, 2026
  5. ariofrio commented on Aug 19, 2026

    @ariofrio
    ContributorAuthor

    Implemented the failures documented in the reproduction/root-cause report and rebased #1428 onto current upstream/main.

    Repository-native regression coverage now verifies:

    • the shell, editable-control restoration, active-region, and nested-control CSS contracts
    • selectable boundaries for queued drafts; approval details and plan paths; Markdown, previews, diffs, terminal/tool output, logs, plugin panels, diagnostics, errors, toasts, thread titles, and displayed commands
    • pointer interaction switching between content regions
    • Cmd/Ctrl-A being scoped to the active region
    • keyboard focus activating a content region
    • app chrome, editors, and nested controls retaining their native keyboard behavior
    • explicitly selectable controls, including copyable diagnostics, scoping Select All
    • managed focus state and event behavior being cleaned up on unmount

    Mutation checks confirmed the focused hook tests fail when pointer activation or keyboard-focus activation is disabled, then pass with production behavior restored.

    Manual Electron dev-app QA confirmed the browser-engine behavior that jsdom cannot model faithfully: app chrome and empty layout surfaces do not create selections; gutter-start and multi-message drags work; Select All stays within the interacted conversation; the real composer retains native Select All; and the Add Machine install.sh command remains selectable.

    The implementation does not register a global JavaScript Cmd-A handler. Pointer/focus listeners activate one region, and the keyboard listener exists only on that active region element until it deactivates.

    Validation on head 84a9efde1: 368 test files / 2,909 tests passed (3 skipped), typecheck passed, lint passed with 0 errors, and the production build passed. The focused tracking suite has 6 passing tests.

    Written by Codex

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

    confirmed-reproui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions