Webview captures macOS system shortcuts, preventing cmd+h and other system commands
Description
When the Claude Code chat interface (webview) has focus, macOS system-level keyboard shortcuts are captured by the webview and don't reach the operating system. This prevents common system shortcuts from working without first manually clicking outside the Claude chat area.
Steps to Reproduce
- Open Claude Code in VSCode (sidebar or panel)
- Click in the Claude chat input or anywhere in the Claude interface
- Press
cmd+h(macOS "Hide Window" shortcut) - Result: Nothing happens - VSCode window doesn't hide
- Click on the file explorer or editor
- Press
cmd+hagain - Result: VSCode window hides as expected
Expected Behavior
System-level shortcuts like cmd+h, cmd+m (minimize), and cmd+q (quit) should work regardless of whether the Claude webview has focus, as they do in native VSCode elements.
Actual Behavior
These shortcuts are captured by the webview and don't propagate to the OS, requiring users to manually move focus away from Claude first.
Additional Context
- The
cmd+escapekeybinding (defined in package.json line 267-271) to blur Claude also doesn't work when the webview has focus - This affects the user experience as it breaks muscle memory for common macOS window management
- Other VSCode extensions with webviews (like browser previews) typically pass through system shortcuts
Suggested Solution
In the webview's JavaScript code, add event handlers to pass through system-level shortcuts:
window.addEventListener('keydown', (e) => {
// Pass through macOS system shortcuts
if (e.metaKey && !e.shiftKey && !e.altKey && !e.ctrlKey) {
if (['h', 'm', 'q', 'w'].includes(e.key.toLowerCase())) {
// Let the event bubble to the OS
return;
}
}
// Handle other shortcuts normally
});
Environment
- Claude Code Extension Version: 2.1.39
- VSCode Version: 1.94.0+
- OS: macOS (Darwin 25.2.0)
- Location Setting: Panel
Impact
Medium - This is a quality-of-life issue that affects daily workflow for macOS users who rely on keyboard shortcuts for window management.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗