mirror of
https://github.com/stablyai/orca.git
synced 2026-10-13 08:02:52 +00:00
fix: allow Option+Backspace word-delete in input fields
The terminal's Alt+Backspace and Ctrl+Backspace keyboard handlers were registered on window with capture:true, intercepting the events globally — even when focus was in an input or textarea. This prevented native word-delete (Option+Backspace on macOS) from working in dialogs like the Add Worktree form. Skip the PTY forwarding when the event target is an INPUT or TEXTAREA. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user