From 361b6dae3cafcaba141e07026694c5c6a34e4905 Mon Sep 17 00:00:00 2001 From: MK Fain Date: Wed, 3 Dec 2025 20:40:05 -0600 Subject: [PATCH] Keep textarea focused in GlobalChatPane after AI responds - Focus textarea immediately after sending message (not after AI response) - Add useEffect to refocus textarea when isLoading becomes false - User can now type their next message right away without clicking --- src/components/GlobalChatPane.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/GlobalChatPane.tsx b/src/components/GlobalChatPane.tsx index aa1af194..de405b3f 100644 --- a/src/components/GlobalChatPane.tsx +++ b/src/components/GlobalChatPane.tsx @@ -164,12 +164,19 @@ export function GlobalChatPane() { const messageContent = input.trim(); setInput(''); - await sendMessage(messageContent, providerModel); - - // Focus back on textarea + // Focus immediately so user can keep typing textareaRef.current?.focus(); + + await sendMessage(messageContent, providerModel); }, [input, isLoading, providerModel, sendMessage]); + // Refocus textarea when AI finishes responding + useEffect(() => { + if (!isLoading && isOpen && messages.length > 0) { + textareaRef.current?.focus(); + } + }, [isLoading, isOpen, messages.length]); + const handleKeyDown = useCallback((e: React.KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey && !isMobile) { e.preventDefault();