[BUG] ALT+TAB back to VS Code extension causes certain key presses (e.g., PrtSc, Henkan) to trigger menu bar focus
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?
After switching back to VS Code via ALT+TAB, pressing certain keys in the Claude Code
prompt editor causes the menu bar to receive focus, as if ALT were pressed alone.
Any subsequent keypresses then operate on the menu, which can trigger _unintended destructive commands_.
The affected keys include: Henkan (変換), Muhenkan (無変換), Eisu (英数), and PrtSc.
Regular character keys and keys such as Insert, Pause, Scroll Lock, and Num Lock are not affected.
What Should Happen?
- Henkan (変換), Muhenkan (無変換), and Eisu (英数) should control the IME
- PrtSc should not affect focus
- Pressing ALT while the prompt editor is focused moves focus to the menu bar;
pressing ALT again should return focus to the prompt editor
Error Messages/Logs
N/A
Steps to Reproduce
- Focus the Claude Code extension's prompt editor in VS Code
- Switch to another application using ALT+TAB
- Switch back to VS Code using ALT+TAB
- Press PrtSc, Henkan (変換), Muhenkan (無変換) or Eisu (英数)
- Confirm the menu bar is focused
- (additional) Press ALT key to see that it does not bring the focus
back to the prompt editor
Workaround: Pressing Ctrl once after returning to VS Code clears
the stuck ALT state, after which the problematic keys work correctly.
Pressing Pause, Scroll Lock, or Num Lock also clears the state, instead
of causing the problem.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.87 (Claude Code)
Platform
Other
Operating System
Windows
Terminal/Shell
Other
Additional Information
- This issue does not occur in the VS Code main editor (Monaco), integrated
terminal, or GitHub Copilot Chat panel — only in the Claude Code prompt editor
- Pressing ALT as a second time on the menu bar does not return focus to the prompt editor
(it does in GitHub Copilot Chat). I do not see this is a related issue or not.
- ALT+TAB alone occasionally moves focus to the menu bar without any subsequent key
press, though this is not consistently reproducible. I do not see this is a related issue or not.
The root cause is likely that the ALT keyup event from ALT+TAB is not delivered correctly
to the webview context. Keys that generate IME-specific or system-level Windows messages
bypass the webview and interact with the residual ALT state at the parent VS Code window level,
triggering menu bar focus.
Additional environment detail: Japanese 109 keyboard is used.
The primary affected keys (Henkan, Muhenkan, Eisu) are Japanese IME control keys
specific to Japanese 109 keyboards. PrtSc also reproduces the issue and is not
keyboard-layout-specific, but the practical impact is concentrated on IME users
(Japanese, Korean, Chinese, etc.) who tend to press IME keys immediately after
returning to VS Code.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗