From 99680baf83cd494a97b4db115ba2f1a2a4f7ce06 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Tue, 16 Dec 2025 15:25:00 -0600 Subject: [PATCH] fix(desktop): focus prompt input after dialog close --- packages/desktop/src/components/prompt-input.tsx | 1 + packages/ui/src/components/session-turn.tsx | 3 +-- packages/ui/src/context/dialog.tsx | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/desktop/src/components/prompt-input.tsx b/packages/desktop/src/components/prompt-input.tsx index a04211a98..b152ff0f5 100644 --- a/packages/desktop/src/components/prompt-input.tsx +++ b/packages/desktop/src/components/prompt-input.tsx @@ -850,6 +850,7 @@ export const PromptInput: Component = (props) => {
{ editorRef = el props.ref?.(el) diff --git a/packages/ui/src/components/session-turn.tsx b/packages/ui/src/components/session-turn.tsx index 14e4055ca..cab6a7af3 100644 --- a/packages/ui/src/components/session-turn.tsx +++ b/packages/ui/src/components/session-turn.tsx @@ -108,8 +108,7 @@ export function SessionTurn( createResizeObserver( () => state.contentRef, - ({ height }) => { - console.log(height) + () => { scrollToBottom() }, ) diff --git a/packages/ui/src/context/dialog.tsx b/packages/ui/src/context/dialog.tsx index 71fc63806..56be9ee47 100644 --- a/packages/ui/src/context/dialog.tsx +++ b/packages/ui/src/context/dialog.tsx @@ -33,6 +33,10 @@ function init() { }, close() { active()?.onClose?.() + if (!active()?.onClose) { + const promptInput = document.querySelector("[data-component=prompt-input]") as HTMLElement + promptInput?.focus() + } setActive(undefined) }, show(element: DialogElement, owner: Owner, onClose?: () => void) { @@ -48,7 +52,6 @@ function init() { open={true} onOpenChange={(open) => { if (!open) { - console.log("closing") result.close() } }}