From 6e1400fc455f71203a5c15ad64b8c0bb73211290 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 2 Apr 2026 23:20:56 +0200 Subject: [PATCH] dialog aware prompt cursor (#20753) --- .../src/cli/cmd/tui/component/prompt/index.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index 0c55ef6276..382bd2806e 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -442,8 +442,15 @@ export function Prompt(props: PromptProps) { }) createEffect(() => { - if (props.visible !== false) input?.focus() - if (props.visible === false) input?.blur() + if (!input || input.isDestroyed) return + if (props.visible === false || dialog.stack.length > 0) { + input.blur() + return + } + + // Slot/plugin updates can remount the background prompt while a dialog is open. + // Keep focus with the dialog and let the prompt reclaim it after the dialog closes. + input.focus() }) createEffect(() => {