fix(desktop): focus prompt input after dialog close

This commit is contained in:
Adam 2025-12-16 15:25:00 -06:00
parent 9aa5460a0e
commit 99680baf83
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
3 changed files with 6 additions and 3 deletions

View file

@ -850,6 +850,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
</Show>
<div class="relative max-h-[240px] overflow-y-auto">
<div
data-component="prompt-input"
ref={(el) => {
editorRef = el
props.ref?.(el)

View file

@ -108,8 +108,7 @@ export function SessionTurn(
createResizeObserver(
() => state.contentRef,
({ height }) => {
console.log(height)
() => {
scrollToBottom()
},
)

View file

@ -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()
}
}}