From 1648d991782e023e4eb285e12dfd04a989ae69dc Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sun, 26 Apr 2026 15:24:53 +0200 Subject: [PATCH] auto-focus prompt textarea on every render --- src/components/PromptBar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/PromptBar.tsx b/src/components/PromptBar.tsx index 487d86c..75844c5 100644 --- a/src/components/PromptBar.tsx +++ b/src/components/PromptBar.tsx @@ -1,4 +1,4 @@ -import { useState, useRef } from 'preact/hooks' +import { useState, useRef, useEffect } from 'preact/hooks' interface Props { running: boolean @@ -10,6 +10,8 @@ export function PromptBar({ running, onSend, onStop }: Props) { const [value, setValue] = useState('') const ref = useRef(null) + useEffect(() => { ref.current?.focus() }) + const submit = () => { const text = value.trim() if (!text || running) return