Skip to content

Mouse Click After Drag Selection Malfunctions in Jupyter Notebooks (Ghost Selection) #279287

@hanbio9

Description

@hanbio9

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:
    Version: 1.106.2 (user setup)
    Commit: 1e3c50d
    Date: 2025-11-19T16:56:50.023Z
    Electron: 37.7.0
    ElectronBuildId: 12781156
    Chromium: 138.0.7204.251
    Node.js: 22.20.0
    V8: 13.8.258.32-electron.0
  • OS Version:
    Windows 11 (25H2, Build 26200.7171)

Crucially: When the user attempts to scroll manually using the mouse wheel while dragging, the selection extension stops. The bug occurs when the mouse is dragged past the boundary, forcing the high-speed auto-scroll, indicating a failure in the event handler for this specific auto-scroll action. After this forced auto-scrolling selection is complete, the selection state is corrupted, causing subsequent single clicks to initiate an extended selection.

Steps to Reproduce:

  1. Open an .ipynb file with a code cell that contains enough text to exceed the editor's visible height (requires scrolling).
  2. Attempt to select the entire cell content by starting a drag selection inside the cell.
  3. Attempt to manually scroll down while dragging to extend the selection to the bottom of the cell.
  4. Observe: Manual scrolling is blocked. The editor forces an automatic, high-speed drag-scrolling motion to extend the selection.
  5. Release the mouse button (selection is complete).
  6. Single-click anywhere inside the cell (triggers ghost selection).

Actual Behavior
The single click registers as a selection extension (Shift + Click), with the selection automatically extending from the previous selection's end point to the new single-click location.
This "ghost selection" state persists even after attempting to clear it with the Esc key, and is not reliably cleared by navigating to other cells.
The issue only clears temporarily upon physical mouse disconnection/reconnection or a full tab switch (switching to another file tab and returning).
This behavior persists even after trying to clear the state with the Esc key.

Expected Behavior
The editor should allow for manual drag-scrolling (scrolling the viewport while holding the mouse button down).
A single click after any selection should clear the previous selection and place the text cursor at the new location.

The initial troubleshooting process focused on isolating the bug's origin, ruling out common causes like extension conflicts, environment issues, and hardware faults. This included testing the bug in the latest stable version of VS Code as well as the Insiders version, with all user-installed extensions disabled using the safe mode (code --disable-extensions). The issue persisted across all these configurations. Furthermore, physical device troubleshooting was performed: the user replaced the mouse hardware, but the bug continued to reproduce. Attempts to reset the selection state using keyboard commands, specifically pressing the Esc key repeatedly, also failed to clear the residual "ghost selection." The only temporary relief was observed when the mouse was physically disconnected and reconnected.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions