From 2ffb05e74657235a57a846fe8c4d4dceefeb3d5c Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Fri, 7 Aug 2026 18:57:44 +0200 Subject: [PATCH] fix: only auto-focus the assistant composer in the floating panel The composer auto-focused in both the board widget and the floating panel, so on page load the widget stole focus and scrolled the page to it, and opening the panel made focus jump between the two composers. Make auto-focus opt-in via an autoFocusComposer prop: the floating panel enables it (explicit intent to compose), while the widget leaves it off. --- apps/nextjs/src/components/assistant/assistant-panel.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/nextjs/src/components/assistant/assistant-panel.tsx b/apps/nextjs/src/components/assistant/assistant-panel.tsx index f68370ca7..4c9f95da4 100644 --- a/apps/nextjs/src/components/assistant/assistant-panel.tsx +++ b/apps/nextjs/src/components/assistant/assistant-panel.tsx @@ -130,6 +130,7 @@ export interface AssistantConversationControls { modelOptionsLoading: boolean; reasoning: AssistantReasoningMode; isRefreshing: boolean; + autoFocusComposer?: boolean; onRefresh: () => Promise; onModelChange: (modelId: string) => void; onReasoningChange: (reasoning: AssistantReasoningMode) => void; @@ -2207,8 +2208,8 @@ const Composer = (props: ComposerProps) => { placeholder={t("composerPlaceholder")} directiveChip={ContextDirectiveChip} // oxlint-disable-next-line jsx-a11y/no-autofocus -- opening the assistant is an explicit intent to compose - autoFocus - data-autofocus + autoFocus={props.autoFocusComposer} + data-autofocus={props.autoFocusComposer ? true : undefined} /> {running ? ( @@ -2432,6 +2433,7 @@ export const AssistantConversationSurface = ({ modelOptionsLoading, reasoning, isRefreshing, + autoFocusComposer, onRefresh, onModelChange, onReasoningChange, @@ -2536,6 +2538,7 @@ export const AssistantConversationSurface = ({ onRefresh={onRefresh} onModelChange={onModelChange} onReasoningChange={onReasoningChange} + autoFocusComposer={autoFocusComposer} pendingAction={pendingAction} /> @@ -2618,6 +2621,7 @@ export const AssistantPanel = ({ onRefresh={onRefresh} onModelChange={onModelChange} onReasoningChange={onReasoningChange} + autoFocusComposer onMinimize={onClose} />