Repository navigation
Fix lost first tap on mobile follow-up submit - #1771
Merged
Merged
Conversation
Collaborator
|
Ty for this fix! |
SawyerHood
added a commit
that referenced
this pull request
Aug 19, 2026
…routes, composer retention (E1, E6, E7, E10, D3, J3, J4, I6, B28) (#1900) ## What was wrong On phones (iOS Safari, compact viewports) several app-side patterns made every page and every thread heavier than it needed to be: - Sidebar rows wrapped each row in a modal Radix ContextMenu whose 700 ms long-press set aria-hidden on #root, registered a non-passive touchmove and flipped body pointer-events with the timeline mounted behind the drawer (E1). - dnd-kit's TouchSensor kept a permanent non-passive window touchmove listener from sidebar DndContexts mounted at boot, and the SidebarInset swipe-open registered another one for every content touch. Both make the first move of every scroll wait for the main thread (E6, E7). - Settings/Tools routes swapped the whole AppSidebar out; returning remounted ProjectList in the closed drawer (E10). - A pending permission/question swapped FollowUpPromptBox out of the tree, rebuilding TipTap per approval (D3). - The collapsed compact composer built the full TipTap editor during thread mount (D5 (reverted, see below)). - Fixed-panel storage was scanned and zod-parsed on every navigation and re-written on mount (J3). - Heavy per-thread caches used the default 5-minute gcTime (J4). - PR check icons and the GitHub logo fetched light+dark PNGs from github.githubassets.com (I6). - Root compose showed only "Loading…" until the sidebar bootstrap settled (B28). ## What changed - E1: `CompactLongPressMenu` (long-press/right-click detector, nothing mounted until first open) opens the existing responsive drawer with the same DropdownMenu items; desktop keeps the context menu. - E6: `SidebarTouchSensor` installs dnd-kit's listener only while the compact drawer shows (external store written by SidebarProvider, no context subscription); tab strip wires TouchSensor only when open with 2+ tabs. - E7: only edge-zone touches (24-72 px) get the non-passive swipe path; deeper touches keep the recognizer on a passive listener without preventDefault. - E10: on compact one persistent `<Sidebar>` panel hosts the AppSidebar body (hidden while Settings/Tools body shows); `mobileHosted` mode on AppSidebar/SectionSidebar; 220 ms close hold preserved. - D3: `pendingInteraction` prop on FollowUpPromptBox keeps the editor shell mounted and hidden, interaction as last stack item, footer pickers read-only. - D5 (reverted, see below): static 48 px compact row on compact + coarse pointer; editor realizes after paint (idle/timeout, transition) or at first tap (pointerdown mounts under an overlay, click focuses via `focusEndForTap`); Stop/voice/drafted submit work from the row; #1771 handoff untouched. - J3: prune once per page load from idle, lastUsedAt checked before schema parse, no-op storage writes skipped. - J4: `HEAVY_PAYLOAD_QUERY_POLICY` (60 s gc) on turn-summary details and file previews; diff patches use a reader lease with a 60 s post-unmount eviction (observer-less entries no longer gc while shown). - I6: bundled GitHub glyph + theme-token status dot; logo via the shared icon. - B28: composer renders immediately with a loading project picker; projectId-keyed queries gate on the settled bootstrap. ## How you verified - `pnpm exec turbo run typecheck --filter=@bb/app`: pass. - `pnpm exec turbo run lint --filter=@bb/app`: 0 errors (147 pre-existing warnings, unchanged count). - `pnpm exec turbo run test --filter=@bb/app --force`: 364 files, 2906 passed, 3 skipped (one registry boundary test fixed in the last commit and re-run green). - New/updated tests: compact-long-press-menu.test.tsx, useSidebarReorderDnd.test.tsx (sensor install/remove), sidebar.test.tsx (passive vs non-passive registration), AppLayoutSidebar.test.tsx (single panel + single mount across app -> settings -> tools -> app), FollowUpPromptBox.test.tsx (editor DOM identity across pending interaction; deferred compact editor lifecycle), ThreadDetailPromptArea.test.tsx (composer retained + stack ordering), fixed-panel-tabs-sync.test.ts (no rewrite, prune decisions), use-environment-diff-patches.test.tsx (retention lease), PluginNewThreadComposer.test.tsx (root composer before settle, gated queries). Fixes: mobile perf sweep findings E1, E6, E7, E10, D3, D5 (reverted, see below), J3, J4, I6, B28. ## Update (2026-08-19) The deferred compact follow-up editor (D5: static stand-in row + pointerdown/click focus handoff) was removed from this PR after a device test on iPhone showed the caret rendering above the composer after the first tap and a ~11 px footer shift when the real editor replaced the stand-in. The compact composer keeps the previously verified always-mounted behavior (#1263, #1381, #1771). D5 stays open as a follow-up once it can be verified on iOS. Fixes: part of the mobile / iOS Safari performance program (verified sweep report in the bb thread; no single issue). ## Stack context Layer 21 of 22 in the `bb/mobile-perf/*` stack (bottom → top: quick wins first, big rocks last). - Prerequisite (layer below): `bb/mobile-perf/markdown-streaming-and-containment` (#1899). - Next layer: `bb/mobile-perf/diff-and-file-preview` (#1901). - Audit findings addressed: see title IDs. Review: approved-with-fixes; 5 review fix commit(s). - Deliberately not done here: D5: reverted after an iPhone test showed a mispositioned caret and a footer shift; needs a device-verified handoff before it returns - Reviewer notes / follow-ups: Device/iOS Simulator verification still needed for: D5 tap handoff (pointerdown-cancel + click focus with real TipTap; jsdom mocks PromptBoxInternal), E7 deep-content passive swipe | E1: ThreadActionsContextMenu/ProjectActionsContextMenu now branch on useIsCompactViewport, so crossing the compact breakpoint (tablet rotation, window resize) remounts every row's | J4: diff patches now refetch after >60 s away from a thread; turn-summary details/file previews gc after 60 s without observers (by design per audit). - Wire/contract: None. No server/daemon wire, protocol, CLI, plugin API, or DB changes; HOST_DAEMON_PROTOCOL_VERSION untouched. All changes are in apps/app. > AGENT GENERATED: by Claude Code (claude-mangosteen-eap) --------- 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.
User-facing problem
On iPhone, submitting a follow-up can feel like the button ignored the first tap:
This is especially confusing because it resembles network lag, even though the first submission never actually committed.
What this changes
The submit button now checks which DOM element the browser actually considers focused instead of relying on TipTap's event-derived focus flag.
During the brief iOS focus transition where those states can disagree, bb keeps the editor and keyboard stable long enough for the first tap to produce its click. After submission commits, the existing keyboard dismissal and compact-composer behavior continue normally.
The change is intentionally narrow: genuine focus outside the editor behaves as before, and desktop submission behavior is unchanged.
Verification