Skip to content

Prevent sidebar and overlay clicks from starting a stuck ChatView text selection #360

Description

@Tryanks

Status: OPEN — temporarily blocked on an upstream gpui-kit issue. The automatically opened upstream PR was closed pending complete root-cause analysis and review. This is an investigation record, not a fix/completion claim or a release gate.

Investigation progress — 2026-09-08

Native observation. In an isolated signed Tcode app on macOS 26.6.2 arm64 with fixture markdown, use the actual thread menu Export as Markdown → Copy, close the resulting notification, then move the pointer over chat with no mouse button pressed. The baseline unexpectedly selected text from the first paragraph into later paragraphs in both light/dark themes at normal width. The experimental candidate did not select chat after that same sequence. A legitimate cross-paragraph drag still selected text; movement after release retained the selection, and native copy/paste reproduced the selected text.

Owner and findings. The tested baseline was gpui-base 9d9bd9bfa9b4c3af25475078458b3e3c7abd2981, with the shared selection owner in crates/base/src/text_selection.rs. Real dispatch tests established that an occluding press could arm underlying selection through a proxy endpoint and that a foreground consumer of bubble-phase mouse-up could leave a gesture active. Button-up movement/focus cancellation also needed to end that retained gesture. These are experimentally demonstrated failure paths on the tested baseline. The initial mouse-down/mouse-up leakage hypothesis is therefore supported by owner dispatch reproduction, but there is no retained complete native event-phase trace proving every native surface follows the identical path.

Candidate and red/green evidence. AI-authored candidate e12d6962f8b5b8807b7539e362608e79f55d73e1 rejects out-of-participant gesture starts and ends gestures on captured left release, button-up movement and window deactivation. Its parent is the separate #356 candidate 94ae00c59ac6e59e858882989c5c12e69863c569; standalone selection branch commit is e27ce1d31c99dfabf9bfad1d2e9e8c91fdcc654a. Actual dispatched tests failed before the fix for consumed release and occluder-start cases; the scoped owner text_selection:: suite passed 46 tests afterward (not the whole upstream suite). That count was rechecked in /tmp/tcode-interaction-published-selection.log from the fresh combined-candidate clone. The prior Tcode integration run passed 56 markdown tests with the local candidate patch, including existing link/copy/context-menu coverage; this is prior recorded run evidence, not a new test run. Its real sidebar/dialog/popover/notification regression had failed on the baseline when focus loss/button-up movement extended selection across additional paragraphs.

Provenance and current disposition. These commits were previously published to the user-owned fork; they are not unpublished. Upstream PR #3012 is closed; the proposal remains unreviewed and unaccepted as a fix. The temporary Tcode fork pin and pending layered regression were withdrawn from #382. No durable candidate dependency pin or current-main fix was delivered for this issue. Local dependency commits remain in /tmp/tcode-gpui-interactions; /tmp/tcode-gpui-published-verification retains the fresh combined-candidate checkout. Tcode investigation was preserved at backup commit 70e04a3e5fb00704d188e023fc553b2b1fe23935 before withdrawal.

Evidence limits / paused work. Native before/after screenshots exist only in the prior CUA transcript, not retained issue-specific PNGs; the #354 PNGs do not evidence this bug. Native mid-drag OS focus loss/outside-window release and the full narrow overlay matrix were not exercised; activation/release cancellation was tested through real GPUI dispatch. Native link navigation was not exercised; automated markdown link/copy tests passed. Baseline binary /tmp/tcode-interaction-before-bin remains. Current-upstream compatibility is not established by these baseline results. A separate #356 merge attempt encountered newer multi-cursor changes in input element.rs/state.rs and is paused in /tmp/tcode-gpui-caret-upstream; this is not a demonstrated selection-file conflict. No conflict resolution or resubmission is being resumed here.

Historical record — superseded and non-authoritative

The body below is preserved for historical reproduction/context only. Its former next-release requirement, acceptance checklist and other AI-authored constraints were explicitly withdrawn by the user and are not authoritative requirements or release gates. Statements that GUI reproduction had not yet occurred describe the earlier audit and are superseded by the dated investigation above.

Temporarily blocked on an upstream gpui-kit issue. The automatically opened upstream PR was closed pending complete root-cause analysis and review; a reviewed proposal will be submitted later.

Closed upstream proposal: longbridge/gpui-kit#3012

Next-release requirement (2026-09-08): This issue must be completed before the next release. The existing scope, diagnosis and acceptance criteria below remain in force.

Reported reproduction

With selectable messages visible in ChatView:

  1. Click a control in the sidebar, a dialog, or the close button of the top-right notification.
  2. Release the mouse button and move the pointer over the chat.
  3. Observe text selection continuing to follow the pointer even though the button is up.
  4. Click in ChatView again: the release ends the drag at that position. A further click clears the selection.

Expected: a gesture that begins outside selectable chat content never starts a chat selection. Every selection drag ends on release or cancellation, even if another surface owns the release.

Current foundation

Text selection was moved to gpui_base::TextSelection in #219. There are existing markdown selection/link tests and a prior titlebar-specific fix in #191. Trace the current shared selection layer, hit testing and propagation through sidebar/dialog/notification surfaces; do not restore an obsolete application-local selection implementation by default.

Mouse-down leaking while mouse-up is consumed is a hypothesis consistent with the report, not a confirmed event trace. Capture event phase, hit target and button state to locate the owner.

Acceptance criteria

  • Sidebar, dialog, popover and notification-close gestures never arm underlying chat selection.
  • A legitimate chat drag still works across markdown blocks and ends when the button is released, including release over an overlay or outside the window and focus loss where the platform permits.
  • Links, context menus and copy continue to work.
  • A regression exercises real event dispatch and layer composition, not just selection-state setters. Verify the reported sequence in both themes and record platform/revision details.

This audit verified the current selection ownership, but did not reproduce the GUI failure.

Code context

Reviewed against main at b4c549787da6 (2026-09-08).

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions