claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] After prompt response, keyboard focus no longer in CLI, jumps to source editor in IntelliJ

Open johnw3d opened this issue 6 months ago • 2 comments

Environment

  • Platform (select one):
    • [x ] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other:
  • Claude CLI version: v1.0.16
  • Operating System: MacOS 15.3.1 (24D70)
  • Terminal: IntelliJ built-in terminal

Bug Description

After entering a CLI prompt and receiving Claude response, keyboard focus is now in the current source, NOT the CLI, so typing next prompt overwrites source code so I have to repeatedly fix that and click back to the terminal

Steps to Reproduce

  1. ensure source file open in IntelliJ IDE
  2. open Claude Code in IntelliJ terminal
  3. issue prompt in the CLI
  4. after response is generated, note that keyboard focus now back in source file, NOT the CLI

Expected Behavior

Keyboard focus to stay in the CLI for the next prompt

Actual Behavior

Keyboard focus jumps to current source file in IntelliJ source editor

Additional Context

johnw3d avatar Jun 06 '25 20:06 johnw3d

Looking into it now! 👀

hackyon-anthropic avatar Jun 09 '25 15:06 hackyon-anthropic

hey @johnw3d, any chance you can see if this is happening to you in plugin version 0.1.8-beta? thanks!

hackyon-anthropic avatar Jun 13 '25 14:06 hackyon-anthropic

This is actually incredibly frustrating because I'll be typing in the CLI, get a change suggestion, and then the next keystroke routinely "accepts" the change suggestion before I ever see it.

I am on plugin version 0.1.11-beta, claude code CLI 1.0.57

Note also that I use Vim mode, both in Claude and in Intellij

WebStorm 2025.1.3 Build #WS-251.26927.40, built on June 20, 2025 Source revision: ce471299dab0d Licensed to Chad Furman Subscription is active until February 27, 2026. Runtime version: 21.0.7+9-b895.130 aarch64 (JCEF 122.1.9) VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Toolkit: sun.lwawt.macosx.LWCToolkit macOS 15.5 GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 8096M Cores: 11 Metal Rendering is ON Registry: ide.balloon.shadow.size=0 editor.distraction.free.mode=true debugger.new.tool.window.layout=true ide.experimental.ui=true cache.folding.model.on.disk=false Non-Bundled Plugins: com.intellij.notebooks.core (251.26927.70) org.jetbrains.completion.full.line (251.26927.999.1) com.jetbrains.edu (2025.6-2025.1-1078) monokai-pro (2.0.2) com.github.xepozz.gitcodeowners (2025.0.31) ru.adelf.idea.dotenv (251.23774.318) com.github.catppuccin.jetbrains (3.4.2) org.jetbrains.plugins.go-template (251.23774.318) org.jetbrains.junie (251.204.104) com.markskelton.one-dark-theme (5.13.0) name.kropp.intellij.makefile (251.25410.28) IdeaVIM (2.26.0) com.anthropic.code.plugin (0.1.11-beta) com.intellij.mermaid (0.0.25+IJ.243) com.intellij.kubernetes (251.26927.91) com.intellij.ml.llm (251.26094.80.22) com.intellij.grazie.pro (0.3.383) PlantUML integration (7.13.0-IJ2023.2) org.jetbrains.plugins.github (251.26927.54-IU) mdx.js (251.23774.318)

chad-fossa avatar Jul 22 '25 15:07 chad-fossa

Following up on this -- it keeps accepting changes when I'm typing because the code diff box pops up

chad-fossa avatar Jul 30 '25 12:07 chad-fossa

@hackyon-anthropic this is still happening. Claude Code will return a response in the middle of me typing, and then all of a sudden I've somehow responded to Claude's prompt and am no longer able to keep typing what I was typing previously (now with an extra unknown change).

I've resorted to auto-accepting edits but that's not a good solution

chad-fossa avatar Aug 25 '25 10:08 chad-fossa

Relates to:

  • https://github.com/anthropics/claude-code/issues/1991
  • https://github.com/anthropics/claude-code/issues/1591
  • https://github.com/anthropics/claude-code/issues/2771
  • https://github.com/anthropics/claude-code/issues/3055

chad-fossa avatar Aug 25 '25 10:08 chad-fossa

Current versions of everything, still having the issue:

WebStorm 2025.2
Build #WS-252.23892.411, built on August 1, 2025
Source revision: 0a9a69b3f9332
Licensed to Chad Furman
Subscription is active until February 27, 2026.
Runtime version: 21.0.7+6-b1038.58 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 15.5
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 8096M
Cores: 11
Metal Rendering is ON
Registry:
  ide.balloon.shadow.size=0
  editor.distraction.free.mode=true
  debugger.new.tool.window.layout=true
  ide.experimental.ui=true
  cache.folding.model.on.disk=false
Non-Bundled Plugins:
  org.jetbrains.junie (252.284.66)
  com.intellij.kubernetes (252.23892.515)
  org.jetbrains.plugins.go-template (252.23892.201)
  ru.adelf.idea.dotenv (252.23892.201)
  JavaScriptDebugger (252.23892.515)
  org.jetbrains.plugins.yaml (252.23892.464)
  org.jetbrains.completion.full.line (252.23892.458)
  com.intellij.ml.llm (252.23892.530)
  com.intellij.microservices.ui (252.23892.464)
  com.intellij.copyright (252.23892.464)
  org.jetbrains.security.package-checker (252.23892.464)
  org.editorconfig.editorconfigjetbrains (252.23892.464)
  com.intellij.notebooks.core (252.23892.464)
  name.kropp.intellij.makefile (252.23892.201)
  com.intellij.mermaid (0.0.26+IJ.252)
  com.intellij.grazie.pro (0.3.390)
  com.jetbrains.edu (2025.7-2025.2-431)
  org.jetbrains.plugins.github (252.23892.515-IU)
  PlantUML integration (7.13.0-IJ2023.2)
  AceJump (3.8.22)
  com.anthropic.code.plugin (0.1.11-beta)
  com.markskelton.one-dark-theme (5.14.1)
  com.github.catppuccin.jetbrains (3.4.2)
  monokai-pro (2.1.0)
  Docker (252.23892.515)
  com.jetbrains.restClient (252.23892.464)
  com.intellij.swagger (252.23892.464)
  com.intellij.react (252.23892.515)
  mdx.js (252.23892.298)

chad-fossa avatar Aug 25 '25 10:08 chad-fossa

Claude code causes input focus issues when it is in the JetBrains integration terminal or any other terminal. I run swaywm and it messes with input focus when it is not even on a visible workspace and is not the currently focused window.

I'll occasionally switch to a terminal window or other application on another workspace and start typing and nothing happens.

I thought it was a sway issue but it turns out if I just stop claude wherever it may be running my keyboard input focus problems stop. So basically I have to be incredibly careful using any other applications while claude code is running anywhere or I might end up typing in the wrong place.

Wielding avatar Oct 10 '25 19:10 Wielding