[BUG] CLI scrolls to the top of the session when right-clicking highlighted text during agent interaction
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?
When using the CLI, depending on whether I'm viewing the top/bottom of the conversation, or if I've scrolled up slightly, right-clicking highlighted text during active agent interaction triggers a bug. This happens especially when I'm asked for edit permission like:
Do you want to overwrite example_script.py? 1. Yes 2. Yes, allow all edits during this session (shift+tab) 3. No
I will now describe the two bug behaviors:
- When the view is at the top or bottom of the conversation:
The view flickers, and the highlighted text is unhighlighted as soon as the context menu appears, which prevents me from clicking "Copy".
- When the view is scrolled up slightly to review change suggestion (not at the top/bottom):
The same behavior as the first case occurs, but in addition, the view unexpectedly scrolls to the beginning of the conversation.
This issue is not caused by any changes in the highlighted text itself.
What Should Happen?
After right-clicking the highlighted text, the text should remain highlighted, and the view should stay in its current position without scrolling. The context menu should appear and remain open until I either click an option or click outside the menu to close it.
Error Messages/Logs
Steps to Reproduce
- Request code change suggestions, such that the CLI asks for permission to edit
- Scroll up slightly
- Highlight some part of the code change suggestion
- Right-click the highlighted text
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.5
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Xterm
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗