From 654e9cdb64e56f3a05108cdaabd2a7e12c164687 Mon Sep 17 00:00:00 2001 From: Serhii Dziupin Date: Wed, 5 Aug 2026 13:37:20 +0300 Subject: [PATCH] feat(chat): refocus composer after adding message to context After the add-to-context (context pin) action completes successfully, move focus back to the chat input so the user can keep typing immediately. Uses the existing focusChatInput helper and the requestAnimationFrame refocus pattern already used by the model/agent selectors. Fixes #2447 --- packages/ui/src/components/chat/ChatMessage.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/ui/src/components/chat/ChatMessage.tsx b/packages/ui/src/components/chat/ChatMessage.tsx index 5b45b4b3..5ec9a8ac 100644 --- a/packages/ui/src/components/chat/ChatMessage.tsx +++ b/packages/ui/src/components/chat/ChatMessage.tsx @@ -37,6 +37,7 @@ import { useGlobalSessionsStore } from '@/stores/useGlobalSessionsStore'; import { getContextObligatoryMessages } from '@/lib/contextObligatoryMessages'; import { setContextObligatoryMessage } from '@/sync/session-actions'; import { isVSCodeRuntime } from '@/lib/desktop'; +import { focusChatInput } from './composer/editor/dom'; const ToolOutputDialog = lazyWithChunkRecovery(() => import('./message/ToolOutputDialog')); @@ -416,6 +417,10 @@ const ChatMessage: React.FC = ({ createdAt: messageCreatedAt, role: isUser ? 'user' : 'assistant', }, !isPinnedIntoContext); + // Return focus to the composer so the user can keep typing right + // after adding the message to context (matches the refocus pattern + // used by the model/agent selectors). + requestAnimationFrame(focusChatInput); } catch (error) { console.error('[chat-message] failed to update context pin', error); toast.error(t('chat.messageBody.actions.contextPinFailed'));