diff --git a/src/renderer/src/components/terminal-pane/keyboard-handlers.ts b/src/renderer/src/components/terminal-pane/keyboard-handlers.ts index 8bf4f7b9d0f..7ce428bd33a 100644 --- a/src/renderer/src/components/terminal-pane/keyboard-handlers.ts +++ b/src/renderer/src/components/terminal-pane/keyboard-handlers.ts @@ -140,6 +140,7 @@ export function useTerminalKeyboardShortcuts({ } // Ctrl+Backspace → send \x17 (backward-kill-word) to PTY. + // Skip when focus is in an input/textarea so native word-delete still works. const onCtrlBackspace = (e: KeyboardEvent): void => { if (!e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) { return @@ -147,6 +148,10 @@ export function useTerminalKeyboardShortcuts({ if (e.key !== 'Backspace') { return } + const tag = (e.target as HTMLElement)?.tagName + if (tag === 'INPUT' || tag === 'TEXTAREA') { + return + } const manager = managerRef.current if (!manager) { @@ -164,6 +169,7 @@ export function useTerminalKeyboardShortcuts({ } // Alt+Backspace → send ESC + DEL (\x1b\x7f, backward-kill-word) to PTY. + // Skip when focus is in an input/textarea so native word-delete still works. const onAltBackspace = (e: KeyboardEvent): void => { if (!e.altKey || e.metaKey || e.ctrlKey || e.shiftKey) { return @@ -171,6 +177,10 @@ export function useTerminalKeyboardShortcuts({ if (e.key !== 'Backspace') { return } + const tag = (e.target as HTMLElement)?.tagName + if (tag === 'INPUT' || tag === 'TEXTAREA') { + return + } const manager = managerRef.current if (!manager) {