fix(keyboard): let browser-native shortcuts pass through handlers #158

Merged
barrettruth merged 1 commit from fix/browser-shortcut-passthrough into main 2026-03-29 05:24:27 +00:00
barrettruth commented 2026-03-29 05:18:46 +00:00

Problem

Delta's keyboard handlers intercept browser-native shortcuts like Ctrl+- (zoom out), Ctrl+T (new tab), Ctrl+W (close tab), and others. The root cause is that handlers check e.key without modifier guards -- for example, pressing Ctrl+- matches e.key === "-" in global-keyboard.tsx and toggles the sidebar instead of zooming out.

Solution

Add a centralized isBrowserShortcut() utility in src/lib/utils.ts that detects browser-native key combinations (zoom, tab/window management, address bar, reload, find, print, devtools, F-keys, and Alt+Arrow for browser back/forward). Guard all five window.addEventListener("keydown") handlers with an early return when a browser shortcut is detected.

Closes #154

## Problem Delta's keyboard handlers intercept browser-native shortcuts like `Ctrl+-` (zoom out), `Ctrl+T` (new tab), `Ctrl+W` (close tab), and others. The root cause is that handlers check `e.key` without modifier guards -- for example, pressing `Ctrl+-` matches `e.key === "-"` in `global-keyboard.tsx` and toggles the sidebar instead of zooming out. ## Solution Add a centralized `isBrowserShortcut()` utility in `src/lib/utils.ts` that detects browser-native key combinations (zoom, tab/window management, address bar, reload, find, print, devtools, F-keys, and `Alt+Arrow` for browser back/forward). Guard all five `window.addEventListener("keydown")` handlers with an early return when a browser shortcut is detected. Closes #154
Sign in to join this conversation.
No description provided.