Skip to content

Keep app chrome out of text selection - #2171

Merged
SawyerHood merged 1 commit into
mainfrom
bb/fix-1440-chrome-user-select
Aug 21, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
bb/fix-1440-chrome-user-select

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Aug 21, 2026 •

Copy link
Copy Markdown
Collaborator

What was wrong

The app set no user-select policy, so every element kept the browser default (auto). Sidebar labels, the page header, the composer toolbar and footer, and the visually hidden "Toggle Sidebar" label all joined mouse-drag selections and Select All alongside the conversation. On main, clicking empty sidebar space and pressing Ctrl-A selects New thread … Extensions … Automations … Settings … Report a bug … Project: qa … Toggle Sidebar, and a drag across the sidebar highlights its labels. Issue: #1440. Report: https://get-bb.github.io/reports/issues/1440.html

What changed

App chrome regions opt out of selection with select-none; content keeps the browser default.

  • apps/app/src/components/ui/sidebar.tsx: both sidebar panels (desktop and compact drawer) and SidebarTrigger.
  • apps/app/src/components/layout/AppPageHeader.tsx: the <header> element.
  • apps/app/src/components/secondary-panel/ThreadSecondaryPanel.tsx: the right panel's top chrome stack (tab toolbar and diff toolbar).
  • apps/app/src/components/promptbox/PromptBoxInternal.tsx, FollowUpPromptBox.tsx, NewThreadPromptBox.tsx: the composer action row and the footer strips below the prompt box. The editor and the banners above it are untouched.
  • apps/app/src/app.css: .select-none :where(input, textarea, [contenteditable]) gets user-select: text. auto resolves from the parent, and WebKit carries a parent's none into editable controls; this keeps the sidebar thread search and the inline thread-title rename selectable.

Why opt out of chrome instead of body { user-select: none } plus content opt-ins (the approach in #1428): in Blink a drag that starts on a user-select: none element never begins a selection, so marking only the chrome leaves gutter drags, multi-message drags, diagnostics (Info panel, settings, toasts, dialogs) and plugin panels exactly as they behave today. A shell-wide none needs every content surface to opt in, and each missed surface becomes uncopyable text. The report measured two such regressions in #1428 (gutter drag selects nothing; Ctrl-A highlights the thread but Ctrl-C copies nothing); #1428 has since grown to 115 files including an Electron menu rewrite and a renderer Select All controller, and conflicts with main. This PR covers the issue's title and its first three acceptance criteria with a class on each chrome root.

Not changed: Select All is not scoped to the last-touched pane (a later criterion added to the issue by #1428); Ctrl-A from the sidebar still selects the conversation text, without any chrome. Timeline status rows ("Worked for 7s", "Working...") remain selectable as part of the conversation.

No wire, CLI or plugin API change.

How you verified

New tests, run against origin/main sources (git checkout origin/main -- <7 source files>) fail, and pass on this branch:

  • apps/app/src/components/layout/app-chrome-selection.test.tsx (4 tests): sidebar panel, drawer, trigger, header, right-panel chrome carry select-none; app.css restores selection on editable controls. Before: AssertionError: expected false to be true, expected 'shrink-0 bg-sidebar' to contain 'select-none'.
  • FollowUpPromptBox.test.tsx "keeps the status footer out of text selection" and PromptBoxInternal.test.tsx "keeps the action row out of text selection while the editor stays selectable". Before: AssertionError: expected false to be true.

Commands on the committed tree (git status --porcelain empty):

  • pnpm exec turbo run typecheck --filter=@bb/app → Tasks: 3 successful, 3 total
  • pnpm exec turbo run test --filter=@bb/app → Tasks: 4 successful, 4 total (410 test files passed)

Manual check in headless Chromium 145 (Puppeteer via doobie) against my dev instance, thread with one user message and one reply, same gestures as the report's probes:

gesture main this branch
click empty sidebar, Ctrl-A 308 chars incl. New thread … Toggle Sidebar 128 chars, conversation only
drag from empty sidebar over labels Settings\nRemote access\nReport a bug… nothing selected
drag across composer footer (Project: qa …) Project:\nqa\nEnvironment:… nothing selected
drag across header title Selection QA nothing selected
drag from gutter 200 px left of a message into it Run the shell command: echo hello-144 same
click message, Ctrl-A, Ctrl-C, paste into editor whole page incl. chrome conversation text only (128 chars)
Ctrl-A inside the editor with a draft draft only draft only

Computed user-select: body auto, sidebar label none, message auto, Info panel directory value auto. Before/after screenshots of Ctrl-A from the sidebar are attached to the batch notes. Not verified in Electron or WebKit (no macOS/iOS here); the WebKit restore rule follows the documented user-select inheritance behavior.

Fixes #1440

AGENT GENERATED: by Claude Opus 5

Independent verification

Verified by a second agent on a fresh worktree (git fetch origin bb/fix-1440-chrome-user-select && git checkout -b verify-1440-r1 FETCH_HEAD, head b728ba309, origin/main is an ancestor, GitHub reports MERGEABLE).

Commands run:

  • pnpm install --frozen-lockfile --prefer-offline && pnpm exec turbo run build → Tasks: 18 successful, 18 total
  • Fail-before: git checkout origin/main -- apps/app/src/app.css apps/app/src/components/layout/AppPageHeader.tsx apps/app/src/components/promptbox/{FollowUpPromptBox,NewThreadPromptBox,PromptBoxInternal}.tsx apps/app/src/components/secondary-panel/ThreadSecondaryPanel.tsx apps/app/src/components/ui/sidebar.tsx, then pnpm exec vitest run src/components/layout/app-chrome-selection.test.tsx src/components/promptbox/FollowUpPromptBox.test.tsx src/components/promptbox/PromptBoxInternal.test.tsx in apps/app → Tests 6 failed | 130 passed (136); failing assertions: AssertionError: expected false to be true (sidebar panel/trigger/header, compact drawer, footer, action row), expected 'shrink-0 bg-sidebar' to contain 'select-none', and the app.css rule match being undefined.
  • Pass-after: git checkout HEAD -- <same files> and the same vitest command → Tests 136 passed (136).
  • pnpm exec turbo run typecheck --filter=@bb/app → Tasks: 3 successful, 3 total
  • pnpm exec turbo run test --filter=@bb/app --force → Tasks: 4 successful, 4 total (410 test files, 3162 tests passed, 3 skipped)
  • Built CSS check: apps/app/dist/assets/index-*.css contains .select-none :where(input,textarea,[contenteditable]:not([contenteditable=false])){-webkit-user-select:text;user-select:text}, so the WebKit prefix is emitted.

Repro on the fixed branch (headless Chromium 145 via doobie, own dev instance, codex thread with one message + reply), same gestures run against origin/main sources and this branch by swapping the 7 source files under Vite HMR:

gesture origin/main sources this branch
click empty sidebar, Ctrl-A 300 chars incl. New thread … Settings … Report a bug … Project: qa … Toggle Sidebar 128 chars, conversation only
drag from empty sidebar up over labels 221 chars (Settings\nRemote access\nReport a bug…) nothing (type: None)
drag across composer footer Project:\nqa\nEnvironment:\nWorking locally\n\nmain\n nothing
drag from gutter 150 px left of a message into it Run the shell command: echo hello-1440. Then reply same text
click message, Ctrl-A, Ctrl-C, paste into editor whole page incl. chrome (308 chars) conversation only (128 chars)
type a draft in the editor, Ctrl-A — draft xyz 1440 only, anchor/focus inside the editor
sidebar thread search input (computed user-select) — text; Ctrl-A and mouse drag select inside the input
header inline title rename input (computed user-select) — text under a none header; Ctrl-A, drag (Selec) and Shift+End all work

Computed user-select on this branch: body auto, sidebar panel none, header none, composer footer none, action row none, editor auto.

CI: all checks green on b728ba309 (Checks, Tests app-1/2/3, integration, packages, server, Package Smoke ubuntu/macos, version checks).

Residual risks: the thread title in the page header is now copyable only through the double-click rename input, not by dragging the label; timeline status rows ("Worked for 7s", "Working...") and dialog/settings labels keep the browser default; Select All is not scoped to the interacted pane and the Electron Edit menu is untouched (later acceptance criteria on the issue, out of scope here); Electron and WebKit/iOS were not exercised (Linux host), the WebKit path relies on the prefixed rule in the built CSS.

AGENT GENERATED: by Claude Opus 5

The app set no user-select policy, so every element kept the browser
default and sidebar labels, page headers, composer toolbars and the
hidden "Toggle Sidebar" label joined mouse-drag selections and Select
All alongside the conversation (#1440).

Mark the chrome regions `select-none`: both sidebar panels and the
sidebar trigger, AppPageHeader, the right panel's top chrome, the
composer action row and the composer footers. A drag that starts on a
`user-select: none` element never begins a selection and Select All
skips those elements, so content, editors and diagnostics keep their
native behavior; a drag that starts in a message gutter still selects
text and Cmd-A on the thread still copies the conversation.

Restore `user-select: text` on editable controls inside opted-out chrome
(sidebar thread search, inline title rename): `auto` resolves from the
parent and WebKit would otherwise refuse to select their text.

Co-Authored-By: Claude <[email protected]>
@SawyerHood
SawyerHood marked this pull request as ready for review August 21, 2026 07:34
@SawyerHood
SawyerHood merged commit d4b91c9 into main Aug 21, 2026
13 checks passed
@SawyerHood
SawyerHood deleted the bb/fix-1440-chrome-user-select branch August 21, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent app chrome from being included in text selection

1 participant