BUGFIX: Fix prompt text input losing focus to terminal (#2615)

This commit is contained in:
Lee Stutzman
2026-04-03 08:10:48 +01:00
committed by GitHub
parent abdf3082ca
commit 63aa4d2a45
2 changed files with 101 additions and 1 deletions

View File

@@ -217,7 +217,11 @@ export function TerminalInput(): React.ReactElement {
const ref = terminalInput.current;
if (event.ctrlKey || event.metaKey) return;
if (event.key === KEY.C && (event.ctrlKey || event.metaKey)) return; // trying to copy
// Don't steal focus from other input elements (e.g., prompt dialogs)
const target = event.target;
if ((target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) && target !== ref) {
return;
}
if (ref) ref.focus();
}
document.addEventListener("keydown", keyDown);