Repository navigation
Open the selection menu below touch selections on Android - #6567
Merged
Merged
Conversation
On Android, long-pressing text in an assistant reply opens the native selection toolbar above the selection, exactly where BB's "Add to chat" and side-chat menu was anchored, so BB's actions were hidden and unreachable. Touch selections now anchor the menu below the last selected line, clear of the selection handles. iOS Safari opens its edit menu below a long-press selection, so iOS WebKit keeps the menu above the selection as before. Fixes #6132 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 3, 2026
## Human comments ## What was wrong `@bb/app` had grown to 657 test files and 6,809 tests. Many tests checked a contract that another test already covered more strongly. Others only exercised wiring, tested a third-party library, or held assertions that could not fail. A few production `export`s and one parameter existed only for these tests. This made the suite slower to run and maintain without catching any extra bugs. ## What changed Test files only, apart from removing test-only exports. Net −1,077 test lines across 58 files (+290 / −1,367), four whole files deleted, and 6,809 → 6,750 tests. Production changes are +8 / −11 across 7 files, with no behaviour change. **Removed** - **Duplicates:** the raw-thread-id title tests that #5261 copied into `ThreadTitleMentions.resources.test.ts` but never removed from the original. Also sibling tests repeating the same setup and assertion, and mocked copies of scenarios that already run through the real code: `composer-submissions`, `app-toast-title-overflow`, OnboardingGate, AddMachineDialog expiry, ToolsView banners, provider-icon, plugin-slots, the cache-owner rename, pin acknowledgement, the CommandPalette settings page, QuestionForm, and the PromptBox/composer-contract rejection. - **Wiring and constant pins:** small helpers tested directly when their only caller is tested (`resolveUrlOpenTarget`, `parseLifecycleError`, `buildAudioInputConstraints`, `resolvePaneArrangementLabel`); realtime registry rows that `satisfies Record<…>` already enforces at typecheck; a snapshot-identity check covered by a stricter structural-sharing test. - **Third-party only:** `src/test/virtualizer-scroll-lifecycle.test.tsx` tested `@tanstack/virtual-core` and guarded a repo patch that #5951 removed. Upstream now cancels the timer itself. - **Vacuous:** a lifecycle-error row varying `hasPath`, which no code reads; BrowserTabDeck rows that pass either way; a FollowUpPromptBox placeholder test whose two placeholders were the same string; a dead `vi.mock` of a module the code under test never imports. - **Test-only production seams:** dropped `export` from `buildAudioInputConstraints`, `buildDevWebSocketUrl`, `resolveUrlOpenTarget`, `parseLifecycleError`, `threadTitleTextSegments` and `resolvePaneArrangementLabel`. Removed `getSecondaryPanelChromeStackClassName`'s `hasGitDiffToolbar` parameter; its only caller passed `false`. **Repaired** (assertions that could not fail) - `plugin-bound-sdk`: the test promised cache updates but only checked call shape. It now asserts that a created section reaches the sidebar cache before `create` resolves. That behaviour (#5045) had no test before. - `split-layout/ops`: `if (root.type === "split")` guards could skip every resize-clamp assertion; they now throw on a non-split root. - `provider-icon`: `toBeDefined()` on a non-optional return replaced with real `ariaLabel` checks. - `use-composers`: the test named "lock or paint" now also exercises `setTextEffect`. - `ThreadMetadataContent`: `path: null` let the "provisioning" test pass without its status check. - Terminal UTF-8 split glyph: this tested the browser's `TextDecoder`. It now writes through `writeTerminalOutput` into a real xterm. - Early `focusEnd`, the voice transition while hidden or under reduced motion, and the model-picker cycle-chord exception could all pass with the guarded code removed. They now fail when it is. - `dev-websocket-url` now goes through `buildBrowserWebSocketUrl`, which also covers the production fallback URL. ## How you verified - **Mutation checks.** Three independent reviewers worked on dedicated worktrees of `main` and of this branch. For every removed or merged test, they wrote the bug it caught as a mutation of the production code. They confirmed the old test fails on `main` and that a remaining test fails on this branch, then restored the source. - About 110 mutations were run. 18 removals turned out to be the only guard on their contract; 16 of those were restored. - The most important restoration: a known raw thread id must display as its title through the synchronous `resolveThreadTitleDisplayText`. The rendered pills hide this bug, but the AppLayout title, archived-threads settings and the parent-thread picker show it. - Other restorations: the Meta+Enter `aria-keyshortcuts` label, QueuedMessagesList open/close reporting and overflow toggling, older touch actions at the former width threshold, the touch-selection menu side (#6567), the terminal-view unmount, the plugin update-action icon, the marketplace icon in AddPluginDialog, the ReuseEnvironmentPicker secondary text, the app chrome row-height token, the focused notification on title Show more, the mapper's unread-error indicator, the `useThreadStorageLocation` fetch, the thread invalidation `maxWait` bounds, and the sidebar info-tab id. - Two gaps were left out on purpose: the `hasPath` lifecycle row (no code reads `hasPath`) and a single `shrink-0` class pin. - Each repaired assertion was shown to fail under a mutation that the old assertion let through. - **Baseline** at 51d8ddc: `pnpm exec turbo run test --filter=@bb/app` ran 6,809 tests, with 6 failures at machine load ~89. All six pass when run alone or at normal load. - **After rebasing onto origin/main:** `pnpm exec turbo run lint typecheck test --filter=@bb/app` gave 0 lint errors, a clean typecheck, and 6,740 of 6,750 tests passing (9 skipped). - The one failure, `CommandPalette` "runs an available shortcut … after closing and restoring focus", timed out opening the palette at load ~79. It failed the same way in the baseline run on `main`. - It passes in five isolated reruns, two of them uncached (`--force`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Opus 5.5 <[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.
Human comments
What was wrong
On a touch selection, the timeline selection menu ("Add to chat", side chat, plugin actions) had no pointer anchor, so
TimelineSelectionMenufell back toside="top"and placed it just above the selected line. Android always opens its native selection toolbar (Copy / Share / Select all / Web search) above the selection too, and a web page cannot move or hide it. The native toolbar covered BB's menu, so on Android Chrome, the PWA and the Android app the BB actions could not be reached. Reported in #6132, with a second report in the comments.What changed
SelectableMessageProse.tsx: when the last pointer down was touch or pen, the reported selection now carries abottomanchor placed under the last selected line, plusTOUCH_SELECTION_HANDLE_CLEARANCE_PX(24px) so the menu clears Android's teardrop selection handles. Mouse and keyboard selections are unchanged.isIOSWebKit) keeps the previous top anchor. In iOS Simulator Safari the edit menu opens below selections in roughly the upper half of the screen, so moving BB's menu below on iOS would collide there. iOS opens its menu above selections lower on the screen, so those still overlap on iOS, as on main. This PR does not fix that case.How you verified
SelectableMessageProse.events.test.tsx: a two-line touch selection is anchored below its last line with the handle clearance, and a later mouse press goes back to the unanchored default. It fails without the change. A second test checks that iOS touch selections keep the default anchor. The coarse-pointer test inTimelineSelectionMenu.test.tsxnow asserts the bottom side for touch-anchored selections.pnpm exec turbo run test --filter=@bb/app -- src/components/thread/timeline/SelectableMessageProse src/components/thread/timeline/TimelineSelectionMenu: 117 passed.turbo run typecheck lint --filter=@bb/appis clean; oxfmt is clean.adb. On main, BB's menu sits under Android's toolbar with only its lower edge visible, matching the issue screenshot. With this change, on a Ladle story and on a real thread served bypnpm start:worktree, BB's menu sits below the handles at both upper and lower positions. Tapping "Add to chat" delivered the selected text.Fixes #6132
🤖 Generated with Claude Code