Repository navigation
Keep app chrome out of text selection - #2171
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The app set no
user-selectpolicy, 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 selectsNew 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.htmlWhat 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) andSidebarTrigger.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])getsuser-select: text.autoresolves from the parent, and WebKit carries a parent'snoneinto 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 auser-select: noneelement 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-widenoneneeds 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 carryselect-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" andPromptBoxInternal.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 --porcelainempty):pnpm exec turbo run typecheck --filter=@bb/app→Tasks: 3 successful, 3 totalpnpm 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:
New thread … Toggle SidebarSettings\nRemote access\nReport a bug…Project: qa …)Project:\nqa\nEnvironment:…Selection QARun the shell command: echo hello-144Computed
user-select: bodyauto, sidebar labelnone, messageauto, Info panel directory valueauto. 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 documenteduser-selectinheritance behavior.Fixes #1440
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, headb728ba309,origin/mainis an ancestor, GitHub reportsMERGEABLE).Commands run:
pnpm install --frozen-lockfile --prefer-offline && pnpm exec turbo run build→Tasks: 18 successful, 18 totalgit 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, thenpnpm exec vitest run src/components/layout/app-chrome-selection.test.tsx src/components/promptbox/FollowUpPromptBox.test.tsx src/components/promptbox/PromptBoxInternal.test.tsxinapps/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 beingundefined.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 totalpnpm exec turbo run test --filter=@bb/app --force→Tasks: 4 successful, 4 total(410 test files, 3162 tests passed, 3 skipped)apps/app/dist/assets/index-*.csscontains.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:
New thread … Settings … Report a bug … Project: qa … Toggle SidebarSettings\nRemote access\nReport a bug…)type: None)Project:\nqa\nEnvironment:\nWorking locally\n\nmain\nRun the shell command: echo hello-1440. Then replydraft xyz 1440only, anchor/focus inside the editoruser-select)text; Ctrl-A and mouse drag select inside the inputuser-select)textunder anoneheader; Ctrl-A, drag (Selec) and Shift+End all workComputed
user-selecton this branch: bodyauto, sidebar panelnone, headernone, composer footernone, action rownone, editorauto.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.