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.
This commit is contained in:
Thomas Camlong authored and ajnart committed 2026-08-13 19:56:44 +02:00
1 parent 921aac0560
commit 2ffb05e746
1 file changed
+6 -2
@@ -130,6 +130,7 @@ export interface AssistantConversationControls {
modelOptionsLoading: boolean;
reasoning: AssistantReasoningMode;
isRefreshing: boolean;
autoFocusComposer?: boolean;
onRefresh: () => Promise<void>;
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 ? (
<ComposerPrimitive.Cancel asChild>
@@ -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}
/>
</ThreadPrimitive.Root>
@@ -2618,6 +2621,7 @@ export const AssistantPanel = ({
onRefresh={onRefresh}
onModelChange={onModelChange}
onReasoningChange={onReasoningChange}
autoFocusComposer
onMinimize={onClose}
/>
</dialog>