Skip to content

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

Description

@Tryanks

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