[BUG]
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Title: TUI right-click copies selection instead of showing context menu
Environment:
- Claude Code v2.1.226 (ARM64 native build)
- macOS 26.5.2 (25F84)
- Apple Terminal.app with xterm-256color
- No CLAUDE_CODE_DISABLE_MOUSE set
Description:
Right-clicking selected text in the Claude Code TUI immediately copies it to clipboard instead of showing the standard Terminal.app context menu (Copy, Paste, Select All, etc.).
Expected behavior:
Right-click on selected text should show the context menu with Copy/Paste/Select All options, as Terminal.app does natively.
Actual behavior:
Right-click copies the selected text to clipboard directly. No context menu appears.
Details:
- The TUI appears to enable xterm mouse tracking (DECSET 1000/1002), which causes Terminal.app to forward right-click as a mouse event to the app instead of handling it natively.
- The app then treats right-click as a copy action.
- This happens in both the text input area and the chat output area.
- Same behavior occurs with or without shell wrapper (squeez PTY).
- Terminal.app's native right-click context menu works correctly outside Claude Code.
- The issue was not present in an earlier session on the same day, suggesting possible state-dependent behavior in mouse protocol initialization.
Workaround:
Use keyboard shortcuts (Cmd+C / Cmd+V) instead of right-click context menu.
What Should Happen?
Suggested fix:
Either don't enable mouse tracking in the TUI (let the terminal handle mouse natively), or if mouse tracking is needed for other UI interactions, forward right-click events back to the terminal by temporarily disabling mouse tracking on right-click or dispatching the native context menu.Ran 1 shell command
USE env var.
Error Messages/Logs
Steps to Reproduce
Right-clicking selected text in the Claude Code TUI immediately copies it to clipboard instead of showing the standard Terminal.app context menu (Copy, Paste, Select All, etc.).
Expected behavior:
Right-click on selected text should show the context menu with Copy/Paste/Select All options, as Terminal.app does natively.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.226.
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗