From 4ca0c3cf281b62eff1d015fd23b85900f745a0c1 Mon Sep 17 00:00:00 2001 From: Dotta Date: Fri, 9 Oct 2026 16:16:48 -0500 Subject: [PATCH] fix: restore keyboard focus after voice connection retry Co-Authored-By: Paperclip --- ui/src/components/voice/TaskVoiceLauncher.tsx | 7 ++++--- ui/storybook/stories/speko-task-launcher.stories.tsx | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/src/components/voice/TaskVoiceLauncher.tsx b/ui/src/components/voice/TaskVoiceLauncher.tsx index 20326644f48..3c7962a6758 100644 --- a/ui/src/components/voice/TaskVoiceLauncher.tsx +++ b/ui/src/components/voice/TaskVoiceLauncher.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useRef, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { chatEndpointsApi } from "@/api/chatEndpoints"; import { useChatConnectorsEnabled } from "@/hooks/useChatConnectorsEnabled"; @@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button"; import { NativeVoiceConversation } from "./NativeVoiceConversation"; export function TaskVoiceLauncher({ companyId, issueId, agentId, boundEndpointId }: { companyId: string; issueId: string; agentId?: string | null; boundEndpointId?: string }) { + const launcher = useRef(null); const { enabled } = useChatConnectorsEnabled(); const [open, setOpen] = useState(false), [selected, setSelected] = useState(""); const connections = useQuery({ queryKey: ["task-voice-endpoints", companyId], queryFn: () => chatEndpointsApi.list(companyId), enabled: enabled && Boolean(agentId || boundEndpointId) }); @@ -14,7 +15,7 @@ export function TaskVoiceLauncher({ companyId, issueId, agentId, boundEndpointId const endpoint = candidates.find((entry) => entry.id === selected) ?? candidates[0]; const connectionError = connections.isError ?

Voice connections could not be loaded.

- +
: null; if (!endpoint && connectionError) return
{connectionError}
; if (!endpoint) return boundEndpointId ?

{connections.isPending ? "Loading voice connection…" : "Voice is unavailable. Check the Speko connection in Apps."}

: null; @@ -22,7 +23,7 @@ export function TaskVoiceLauncher({ companyId, issueId, agentId, boundEndpointId {connectionError} {!open ?
{candidates.length > 1 && } - +
: } ; } diff --git a/ui/storybook/stories/speko-task-launcher.stories.tsx b/ui/storybook/stories/speko-task-launcher.stories.tsx index eb37b62f260..a001969cadb 100644 --- a/ui/storybook/stories/speko-task-launcher.stories.tsx +++ b/ui/storybook/stories/speko-task-launcher.stories.tsx @@ -60,5 +60,6 @@ export const BoundConnectionRecovery: Story = { await userEvent.keyboard("{Enter}"); await expect(canvas.getByRole("button", { name: `Talk to ${spekoAgent.name}` })).toBeVisible(); await expect(canvas.queryByRole("alert")).not.toBeInTheDocument(); + await expect(canvas.getByRole("button", { name: `Talk to ${spekoAgent.name}` })).toHaveFocus(); }, };