fix: Fokus nach Senden zurück ins Eingabefeld

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wm
2026-03-17 14:07:55 +01:00
parent d774d5097d
commit 43c08eafae

View File

@@ -28,6 +28,7 @@ export default function HeroSalesChat() {
// Ref auf den scrollbaren Container nicht auf einen inneren Anker.
// scrollTop = scrollHeight scrollt nur diesen Container, nicht die Seite.
const scrollAreaRef = useRef<HTMLDivElement>(null)
const inputRef = useRef<HTMLInputElement>(null)
useEffect(() => {
const el = scrollAreaRef.current
@@ -40,6 +41,7 @@ export default function HeroSalesChat() {
setInput('')
setError(null)
inputRef.current?.focus()
const userMsg: Message = { id: crypto.randomUUID(), role: 'user', text }
setMessages((prev) => [...prev, userMsg])
@@ -146,6 +148,7 @@ export default function HeroSalesChat() {
{/* ── Eingabe ── */}
<div className="flex items-center gap-3 px-5 py-4 border-t border-gray-200 flex-shrink-0">
<input
ref={inputRef}
type="text"
value={input}
onChange={(e) => setInput(e.target.value)}