fix(desktop): focus prompt input after dialog close
This commit is contained in:
parent
9aa5460a0e
commit
99680baf83
3 changed files with 6 additions and 3 deletions
|
|
@ -850,6 +850,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
||||||
</Show>
|
</Show>
|
||||||
<div class="relative max-h-[240px] overflow-y-auto">
|
<div class="relative max-h-[240px] overflow-y-auto">
|
||||||
<div
|
<div
|
||||||
|
data-component="prompt-input"
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
editorRef = el
|
editorRef = el
|
||||||
props.ref?.(el)
|
props.ref?.(el)
|
||||||
|
|
|
||||||
|
|
@ -108,8 +108,7 @@ export function SessionTurn(
|
||||||
|
|
||||||
createResizeObserver(
|
createResizeObserver(
|
||||||
() => state.contentRef,
|
() => state.contentRef,
|
||||||
({ height }) => {
|
() => {
|
||||||
console.log(height)
|
|
||||||
scrollToBottom()
|
scrollToBottom()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ function init() {
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
active()?.onClose?.()
|
active()?.onClose?.()
|
||||||
|
if (!active()?.onClose) {
|
||||||
|
const promptInput = document.querySelector("[data-component=prompt-input]") as HTMLElement
|
||||||
|
promptInput?.focus()
|
||||||
|
}
|
||||||
setActive(undefined)
|
setActive(undefined)
|
||||||
},
|
},
|
||||||
show(element: DialogElement, owner: Owner, onClose?: () => void) {
|
show(element: DialogElement, owner: Owner, onClose?: () => void) {
|
||||||
|
|
@ -48,7 +52,6 @@ function init() {
|
||||||
open={true}
|
open={true}
|
||||||
onOpenChange={(open) => {
|
onOpenChange={(open) => {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
console.log("closing")
|
|
||||||
result.close()
|
result.close()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue