UI: Follow-up to #2615 (#2622)

This commit is contained in:
catloversg
2026-04-04 05:15:04 +07:00
committed by GitHub
parent 63aa4d2a45
commit 48fad72b6a
2 changed files with 7 additions and 98 deletions

View File

@@ -217,9 +217,14 @@ 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)
// Don't steal focus from other input elements
const target = event.target;
if ((target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) && target !== ref) {
if (
(target instanceof HTMLInputElement ||
target instanceof HTMLTextAreaElement ||
(target instanceof HTMLElement && target.isContentEditable)) &&
target !== ref
) {
return;
}
if (ref) ref.focus();