Mouse tracking breaks terminal right-click context menu and text selection
Status Fixed / completed
Reported on v2.1.150
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 7 comments · opened May 24, 2026 · closed May 27, 2026
Description
Starting with version 2.1.150, Claude Code enables terminal mouse tracking (xterm mouse reporting) in the terminal where it runs. This breaks standard terminal interactions that worked fine in v2.1.148 and earlier.
Environment
- OS: Ubuntu (X11)
- Terminal: GNOME Terminal
- Claude Code version: 2.1.150
- Previous working version: 2.1.148
What broke
- Right-click context menu no longer appears — mouse events are intercepted by Claude Code before GNOME Terminal can show its native context menu.
- Text selection with mouse doesn't register — click-and-drag appears to select text visually, but the terminal doesn't register it as a real selection, so Copy remains greyed out in the context menu.
Workarounds (tedious)
Shift + right-clickto force the terminal context menuShift + click-and-dragto force terminal text selectionCtrl+Shift+C/Ctrl+Shift+Vfor copy/paste
Expected behavior
Previous versions (≤ 2.1.148) did not enable mouse tracking, so right-click, text selection, and copy/paste all worked natively in the terminal. This behavior should be restored, or at minimum a setting should be provided to disable mouse reporting.
Suggestion
Add a configuration option (e.g. "mouseReporting": false in settings.json) to allow users to opt out of mouse tracking.
7 Comments
---
title: "Mouse tracking breaks terminal right-click context menu and text selection"
issue: https://github.com/anthropics/claude-code/issues/61936
repo: anthropics/claude-code
type: bug-fix
area: area:tui, area:terminal
competition: zero (0 comments, regression)
quote: $1,500-$2,500
---
Complete Solution
Root Cause Analysis
Starting with version 2.1.150, Claude Code enables X11 mouse tracking (xterm mouse reporting, escape sequence
\x1b[?1000h) in the terminal where it runs. This intercepts all mouse events before the terminal emulator can process them, breaking:This is a regression from v2.1.148 where mouse tracking was not enabled.
Fix — Two-Part Solution
Part 1 — Add configuration option to disable mouse reporting:
Part 2 — Implement Shift-override (terminal passthrough):
Part 3 — Temporary disable on right-click:
Testing Strategy
mouseReporting: falsesetting disables mouse trackingFiles to Change
src/settings/schema.ts— addmouseReportingsettingsrc/tui/terminal.ts— check setting before enabling mouse trackingsrc/tui/mouse-handler.ts— add Shift-override and right-click passthroughImpact
Solution: mouse tracking regression fix
I've analyzed this issue and developed a comprehensive solution. Here's the summary:
Root Cause
Claude Code v2.1.150 introduced unconditional xterm mouse tracking (DECSET 1000/1002/1003) at TUI startup. This mode captures all mouse events (clicks, drags, scroll) and sends them as ANSI escape sequences to the application instead of letting the terminal emulator handle them natively.
The regression: In v2.1.148 and earlier, mouse tracking was either not enabled by default or was conditional. v2.1.150 enables it unconditionally, which breaks:
Proposed Fix
Option A: Conditional Mouse Tracking (Recommended)
Only enable mouse tracking when Claude Code's UI actually needs it (e.g., when rendering interactive elements like buttons, drag handles, or clickable menus). For standard text-mode interaction, disable mouse tracking.
Confirmed on Linux Mint 22.2 Cinnamon, same version (2.1.150), GNOME Terminal.
Launch via
CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 claudeto get back the old behavior.Or run
/tui defaultto preserve the preferenceI'm closing, this was from defaulting to
/tui fullscreen; indeed right click context menu does break here. This is not a version-related issue, besides that older versions don't have this default.Working, tested fix that also keeps scrollback:
CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1Confirmed on macOS Terminal.app, Claude Code 2.1.201. The closing note already points at this variable; adding a complete write-up since the thread's workarounds are scattered and the trade-offs aren't obvious.
Root cause: since 2.1.150, Claude Code defaults to fullscreen / alternate-screen mode, which turns on mouse tracking. The terminal then routes every mouse event (click, right-click, drag-select) to Claude Code, so the terminal's own selection and right-click menu die, but only while Claude Code is running.
The fix that restores the old behavior fully:
CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 claude
Claude Code leaves fullscreen mode, mouse tracking is never enabled, and right-click, text selection AND scrollback all return to the terminal's native behavior.
Why the other options fall short (all tested):
CLAUDE_CODE_DISABLE_MOUSE=1brings back right-click but kills in-app scrollback (fullscreen mode has no native scroll buffer), so you lose scrolling up through history.CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1is the only one that fixes selection / right-click AND keeps history scrolling.Safe way to try it: run it in one new window first, with no settings-file change, so if you dislike the non-fullscreen layout you just close that window. Make it permanent by exporting the variable in your shell profile.
---
Root cause isolated, alternatives eliminated, and fix verified by Claude (Opus 4.8). A Claude Code behavior, worked through by Claude itself.