[BUG] Input field loses focus after command completion in JetBrains IDE integrated terminal
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 running Claude Code inside the integrated terminal of JetBrains IDEs (PhpStorm, IntelliJ, WebStorm, etc.), the input text field does not automatically receive focus after Claude Code finishes processing a command.
This causes the user to unknowingly type into the code editor instead of the Claude Code input field, resulting in unintended code modifications and syntax errors.
What Should Happen?
Expected Behavior
After Claude Code completes a command, the input field should automatically retain/regain focus so the user can immediately type the next command.
Actual Behavior
The input field loses focus after command completion. The cursor appears to be in the input field, but keystrokes are sent to the code editor instead, causing accidental code modifications.
Environment
IDE: PhpStorm 2024.x (also reproducible in other JetBrains IDEs)
OS: Windows / Linux (observed on both)
Claude Code version: latest
Terminal: JetBrains integrated terminal
Impact
Accidental code edits that may introduce syntax errors
Disrupts workflow as the user must manually click the input field after every command
Especially problematic during rapid iteration sessions where multiple commands are issued in sequence
Notes
This issue does not occur when running Claude Code in an external/standalone terminal (e.g., Windows Terminal, iTerm2, native OS terminal). It appears to be specific to the JetBrains integrated terminal environment.
Error Messages/Logs
Steps to Reproduce
Expected Behavior
After Claude Code completes a command, the input field should automatically retain/regain focus so the user can immediately type the next command.
Actual Behavior
The input field loses focus after command completion. The cursor appears to be in the input field, but keystrokes are sent to the code editor instead, causing accidental code modifications.
Environment
IDE: PhpStorm 2024.x (also reproducible in other JetBrains IDEs)
OS: Windows / Linux (observed on both)
Claude Code version: latest
Terminal: JetBrains integrated terminal
Impact
Accidental code edits that may introduce syntax errors
Disrupts workflow as the user must manually click the input field after every command
Especially problematic during rapid iteration sessions where multiple commands are issued in sequence
Notes
This issue does not occur when running Claude Code in an external/standalone terminal (e.g., Windows Terminal, iTerm2, native OS terminal). It appears to be specific to the JetBrains integrated terminal environment.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.44
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗