claude-code - 💡(How to fix) Fix cmd+escape doesn't blur the input when typing in the Claude Code panel (webview swallows the key) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53055Fetched 2026-04-25 06:13:34
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2

The default keybinding cmd+escape → claude-vscode.blur (declared in the extension's package.json with when: !config.claudeCode.useTerminal && !editorTextFocus) does not fire when the user is actively typing in the Claude Code input. Pressing cmd+escape has no effect — focus stays in the input and subsequent keystrokes continue to be captured by it. The reverse direction (cmd+escape from the editor → claude-vscode.focus) works correctly.

Root Cause

Prior reports of the same symptom that were auto-closed for inactivity without a fix or root-cause analysis: #26189 (closest match — macOS, sidebar mode, "Cmd+Esc keybinding fails in sidebar view mode") and #18266 (related — the focus-direction equivalent on Linux). This issue adds reproduction steps and root cause from inspecting the bundled webview.

Fix Action

Fix / Workaround

Workaround (for users hitting this)

Code Example

{
    "key": "ctrl+8",
    "command": "runCommands",
    "args": {
        "commands": [
            "claude-vscode.blur",
            "workbench.action.focusActiveEditorGroup"
        ]
    }
}
RAW_BUFFERClick to expand / collapse

Prior reports

Prior reports of the same symptom that were auto-closed for inactivity without a fix or root-cause analysis: #26189 (closest match — macOS, sidebar mode, "Cmd+Esc keybinding fails in sidebar view mode") and #18266 (related — the focus-direction equivalent on Linux). This issue adds reproduction steps and root cause from inspecting the bundled webview.

Summary

The default keybinding cmd+escape → claude-vscode.blur (declared in the extension's package.json with when: !config.claudeCode.useTerminal && !editorTextFocus) does not fire when the user is actively typing in the Claude Code input. Pressing cmd+escape has no effect — focus stays in the input and subsequent keystrokes continue to be captured by it. The reverse direction (cmd+escape from the editor → claude-vscode.focus) works correctly.

Environment

  • VS Code: 1.117.0 (arm64)
  • OS: macOS (darwin 25.3.0)
  • Extension: anthropic.claude-code 2.1.119 (darwin-arm64)
  • Setting claudeCode.useTerminal: false (default)

Steps to reproduce

  1. Open any workspace; ensure the Claude Code sidebar is visible.
  2. Click into the Claude Code message input. Type a few characters.
  3. Press Cmd+Escape.

Expected

The input loses focus (per the extension's own claude-vscode.blur keybinding declared in package.json). VS Code's natural focus chain returns focus to the editor.

Actual

Nothing happens. The input retains focus and continues to receive keystrokes. claude-vscode.blur is never invoked.

Root cause (from inspection of the bundled webview)

webview/index.js contains multiple keydown handlers that call preventDefault() + stopPropagation() (and in some cases stopImmediatePropagation()) on e.key === "Escape". Several of these handlers do not filter on e.metaKey / e.ctrlKey, so they swallow cmd+escape along with plain escape. Because the event never bubbles out of the iframe, VS Code's keybinding service never sees it and the cmd+escape → claude-vscode.blur binding never fires.

A few handlers in the same file already guard with !e.metaKey && !e.ctrlKey (e.g. r.key === "Escape" && !r.metaKey && !r.ctrlKey), suggesting the intent was to let modified Escape through — but this guard is missing on at least one handler that owns focus when the user is typing in the input.

Suggested fix

Either:

  • (a) Add the !metaKey && !ctrlKey guard to the remaining Escape handlers in the webview, so cmd+escape propagates to VS Code and the existing keybinding does the blur; or
  • (b) When the webview's input itself sees cmd+escape, explicitly post a message to the host to invoke claude-vscode.blur (and stop propagation locally so other handlers don't see it).

Option (a) is the smaller change and keeps the contract that VS Code keybindings own modified-Escape behavior.

Workaround (for users hitting this)

Bind a non-Escape combo that the webview doesn't intercept, chained via runCommands, in keybindings.json:

{
    "key": "ctrl+8",
    "command": "runCommands",
    "args": {
        "commands": [
            "claude-vscode.blur",
            "workbench.action.focusActiveEditorGroup"
        ]
    }
}

This bubbles up cleanly because the webview's handlers don't intercept Ctrl+digit keys.

extent analysis

TL;DR

The most likely fix is to add a !metaKey && !ctrlKey guard to the remaining Escape handlers in the webview to allow cmd+escape to propagate to VS Code.

Guidance

  • Identify the Escape handlers in webview/index.js that are missing the !metaKey && !ctrlKey guard and add it to them.
  • Verify that the cmd+escape keybinding works as expected after making the changes by following the steps to reproduce and checking if the input loses focus.
  • As an alternative, consider implementing option (b) from the suggested fix, where the webview's input explicitly posts a message to the host to invoke claude-vscode.blur when cmd+escape is pressed.
  • If making code changes is not feasible, use the provided workaround by adding a custom keybinding in keybindings.json to bind a non-Escape combo to claude-vscode.blur and workbench.action.focusActiveEditorGroup.

Example

No code snippet is provided as the necessary changes are specific to the webview/index.js file and require careful examination of the existing code.

Notes

The suggested fix assumes that the issue is caused by the missing guard in the Escape handlers. If the issue persists after making the changes, further debugging may be necessary to identify the root cause.

Recommendation

Apply workaround by adding a custom keybinding in keybindings.json as a temporary solution until the root cause is fixed, as it provides a clean and functional alternative to the cmd+escape keybinding.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix cmd+escape doesn't blur the input when typing in the Claude Code panel (webview swallows the key) [2 comments, 2 participants]