Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(ui): type into the sidebar search field, results drop down under it

rubenluetke10-beep478e4beb0ce9
diff --git a/jarvis/ui/web/frontend/src/components/QuickSwitchList.tsx b/jarvis/ui/web/frontend/src/components/QuickSwitchList.tsx
new file mode 100644
index 0000000000..7713583c74
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/QuickSwitchList.tsx
@@ -0,0 +1,360 @@
+/**
+ * The quick switcher's results — sections, chats, terminals, workspaces and
+ * Settings groups — as one cmdk list, shared by its two shells: the centred
+ * Spotlight window (`QuickSwitcher`, the chord) and the sidebar search field
+ * (`InlineQuickSwitch`), which drops the same list down under itself.
+ *
+ * Must render inside a cmdk `<Command shouldFilter={false}>` whose input feeds
+ * `query`: cmdk drives the keyboard (arrows, Enter, the active row) and the
+ * ranking is ours (`@/lib/quickSwitch` for sections, `@/lib/quickSwitchSources`
+ * for the live lists) and must not be re-scored. The live lists are fetched
+ * once per mount, so the callers mount this only while it is shown.
+ */
+import { Command } from "cmdk";
+import {
+ FolderOpen,
+ MessageSquare,
+ Mic,
+ Settings2,
+ SquareTerminal,
+ type LucideIcon,
+} from "lucide-react";
+import { useEffect, useMemo, useState, type ReactNode } from "react";
+import { useT, useUiLanguage } from "@/i18n";
+import { useEventStore } from "@/store/events";
+import { useHomeStore } from "@/store/home";
+import { useSettingsJump } from "@/store/settingsJump";
+import { useIdeProjectsStore } from "@/store/ideProjects";
+import { useIdeSidePanelStore } from "@/store/ideSidePanel";
+import { formatChatWhen, useChatRows, type ChatRow } from "@/components/home/chatRows";
+import {
+ fetchIdeProjects,
+ fetchWorkspacePanes,
+ type ProjectWorkspace,
+ type WorkspacePaneRow,
+} from "@/lib/agenticIdeApi";
+import {
+ ambiguousEntryKeys,
+ rankQuickSwitch,
+ strongSettingsMatches,
+ type QuickSwitchEntry,
+} from "@/lib/quickSwitch";
+import { folderName, rankItems } from "@/lib/quickSwitchSources";
+import { searchSettingsOptions } from "@/views/settings/settingsSearch";
+import { cn } from "@/lib/utils";
+
+/** Resolve a label, falling back when the key is missing (the resolver echoes it). */
+function useLabel() {
+ const t = useT();
+ return (key: string, fallback: string) => {
+ const value = t(key);
+ return value === key ? fallback : value;
+ };
+}
+
+const ROW = cn(
+ "group flex cursor-default select-none items-center gap-3 rounded-lg px-2.5",
+ "text-foreground outline-none",
+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground",
+);
+
+const TILE = cn(
+ "grid shrink-0 place-items-center rounded-md bg-secondary text-muted-foreground",
+ "group-data-[selected=true]:bg-white/20 group-data-[selected=true]:text-accent-foreground",
+);
+
+const DETAIL = cn(
+ "ml-auto shrink-0 truncate pl-3 text-muted-foreground",
+ "group-data-[selected=true]:text-accent-foreground/80",
+);
+
+const GROUP = cn(
+ "[&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-2.5",
+ "[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
+ "[&_[cmdk-group-heading]]:text-muted-foreground",
+);
+
+/** How many live results each group may show, so the sections stay in view. */
+const LIMIT = { chats: 6, terminals: 6, workspaces: 4, recentChats: 4 } as const;
+
+/** Row sizes: the Spotlight window is roomier than the sidebar dropdown. */
+const SIZE = {
+ large: { row: "h-11 text-base", tile: "h-7 w-7", detail: "text-sm" },
+ compact: { row: "h-9 text-sm", tile: "h-6 w-6", detail: "text-xs" },
+} as const;
+
+type Size = keyof typeof SIZE;
+
+function ResultRow({
+ value,
+ testId,
+ icon: Icon,
+ label,
+ detail,
+ size,
+ onSelect,
+}: {
+ value: string;
+ testId: string;
+ icon: LucideIcon;
+ label: ReactNode;
+ detail?: ReactNode;
+ size: Size;
+ onSelect: () => void;
+}) {
+ const s = SIZE[size];
+ return (
+ <Command.Item value={value} onSelect={onSelect} data-testid={testId} className={cn(ROW, s.row)}>
+ <span className={cn(TILE, s.tile)}>
+ <Icon className="h-4 w-4" aria-hidden />
+ </span>
+ <span className="min-w-0 truncate">{label}</span>
+ {detail ? <span className={cn(DETAIL, s.detail)}>{detail}</span> : null}
+ </Command.Item>
+ );
+}
+
+/**
+ * The open workspaces and their panes, fetched once per mount. A headless or
+ * older backend simply contributes nothing — the search must never fail to
+ * open because the IDE is not there.
+ */
+function useIdeResults(): { panes: WorkspacePaneRow[]; workspaces: ProjectWorkspace[] } {
+ const [panes, setPanes] = useState<WorkspacePaneRow[]>([]);
+ const [workspaces, setWorkspaces] = useState<ProjectWorkspace[]>([]);
+ useEffect(() => {
+ let live = true;
+ fetchWorkspacePanes()
+ .then((found) => {
+ if (live) setPanes(found.panes.filter((pane) => !pane.archived));
+ })
+ .catch(() => {
+ /* no IDE on this backend — no terminal results */
+ });
+ fetchIdeProjects()
+ .then((found) => {
+ if (!live) return;
+ const open = found.projects.flatMap((project) =>
+ project.workspaces.filter((workspace) => workspace.status === "open"),
+ );
+ setWorkspaces(open.sort((a, b) => b.last_active_at - a.last_active_at));
+ })
+ .catch(() => {
+ /* no IDE on this backend — no workspace results */
+ });
+ return () => {
+ live = false;
+ };
+ }, []);
+ return { panes, workspaces };
+}
+
+/** What a terminal row is called: its title, else its last prompt, else its agent. */
+function paneTitle(pane: WorkspacePaneRow): string {
+ return pane.recap || pane.last_prompt || pane.display_name || pane.key;
+}
+
+export function QuickSwitchList({
+ query,
+ onDone,
+ onFirstChange,
+ size = "large",
+ className,
+}: {
+ query: string;
+ /** Called after a result was opened, so the shell can close and clear. */
+ onDone: () => void;
+ /**
+ * Called with the top row's value whenever the set of rows changes. The
+ * terminals and workspaces arrive after the first keystrokes; without this
+ * cmdk keeps its earlier pick, and Enter opened a row further down.
+ */
+ onFirstChange?: (value: string) => void;
+ size?: Size;
+ className?: string;
+}) {
+ const t = useT();
+ const label = useLabel();
+ const language = useUiLanguage();
+ const activeSection = useEventStore((s) => s.activeSection);
+ const setActiveSection = useEventStore((s) => s.setActiveSection);
+ const setSurface = useHomeStore((s) => s.setSurface);
+ const requestSettingsJump = useSettingsJump((s) => s.request);
+ const activateWorkspace = useIdeProjectsStore((s) => s.activateWorkspace);
+ const setSpotlight = useIdeSidePanelStore((s) => s.setSpotlight);
+ const { rows: chatRows, open: openChat } = useChatRows();
+ const { panes, workspaces } = useIdeResults();
+ const typed = query.trim() !== "";
+
+ // About forty destinations — ranked inline on every keystroke, no memo needed.
+ const labelFor = (item: QuickSwitchEntry) => label(item.labelKey, item.fallbackLabel);
+ const ranked = rankQuickSwitch(query, labelFor);
+ const ambiguous = ambiguousEntryKeys(labelFor);
+ const settingsMatches = useMemo(
+ () => strongSettingsMatches(query, searchSettingsOptions(language, query, t)),
+ [query, language, t],
+ );
+ // Nothing typed yet: the most recent chats, like Spotlight's recents.
+ const chatHits = typed
+ ? rankItems(query, chatRows, (row) => [row.title, row.preview], LIMIT.chats)
+ : chatRows.slice(0, LIMIT.recentChats);
+ const paneHits = typed
+ ? rankItems(
+ query,
+ panes,
+ (pane) => [pane.recap, pane.last_prompt, pane.display_name, pane.key, pane.workspace_name],
+ LIMIT.terminals,
+ )
+ : [];
+ const workspaceHits = typed
+ ? rankItems(
+ query,
+ workspaces,
+ (workspace) => [workspace.name, folderName(workspace.folder), workspace.branch],
+ LIMIT.workspaces,
+ )
+ : [];
+
+ const rowValues = [
+ ...ranked.map(({ entry }) => `section:${entry.key}`),
+ ...chatHits.map((row) => `chat:${row.kind}:${row.id}`),
+ ...paneHits.map((pane) => `pane:${pane.workspace_id}:${pane.name}`),
+ ...workspaceHits.map((workspace) => `workspace:${workspace.id}`),
+ ...settingsMatches.map((match) => `setting:${match.id}`),
+ ];
+ const signature = rowValues.join("|");
+ useEffect(() => {
+ onFirstChange?.(rowValues[0] ?? "");
+ // Only when the rows themselves change, never on a mere re-render.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [signature]);
+
+ const go = (item: QuickSwitchEntry) => {
+ if (item.surface) setSurface(item.surface);
+ setActiveSection(item.section);
+ onDone();
+ };
+
+ const goToChat = (row: ChatRow) => {
+ openChat(row);
+ onDone();
+ };
+
+ /** Bring the pane's workspace to the front and frame the pane in the grid. */
+ const goToPane = (pane: WorkspacePaneRow) => {
+ setActiveSection("agentic-ide");
+ if (!pane.workspace_active) activateWorkspace(pane.workspace_id);
+ setSpotlight({ workspaceId: pane.workspace_id, pane: pane.name });
+ onDone();
+ };
+
+ const goToWorkspace = (workspace: ProjectWorkspace) => {
+ setActiveSection("agentic-ide");
+ if (!workspace.active) activateWorkspace(workspace.id);
+ onDone();
+ };
+
+ const goToSetting = (groupId: string) => {
+ requestSettingsJump(groupId);
+ setActiveSection("settings");
+ onDone();
+ };
+
+ return (
+ <Command.List className={cn("overflow-y-auto p-1.5 scrollbar-jarvis", className)}>
+ <Command.Empty className="px-3 py-6 text-center text-sm text-muted-foreground">
+ {t("quick_switch.no_results")}
+ </Command.Empty>
+ {ranked.length > 0 && (
+ <Command.Group heading={t("quick_switch.group_sections")} className={GROUP}>
+ {ranked.map(({ entry: item, label: text }) => {
+ const here = item.section === activeSection && !item.surface;
+ const area = item.parentLabelKey ? label(item.parentLabelKey, "") : "";
+ // A label two rows share names its area up front, e.g.
+ // "Voice › API Keys" beside the API Keys page itself.
+ const shown = area && ambiguous.has(item.key) ? `${area} › ${text}` : text;
+ return (
+ <ResultRow
+ key={item.key}
+ value={`section:${item.key}`}
+ testId={`quick-switch-${item.key}`}
+ icon={item.icon}
+ label={shown}
+ detail={here ? t("quick_switch.current") : shown === text ? area : ""}
+ size={size}
+ onSelect={() => go(item)}
+ />
+ );
+ })}
+ </Command.Group>
+ )}
+ {chatHits.length > 0 && (
+ <Command.Group
+ heading={t(typed ? "quick_switch.group_chats" : "quick_switch.group_recent_chats")}
+ className={GROUP}
+ >
+ {chatHits.map((row) => (
+ <ResultRow
+ key={`${row.kind}:${row.id}`}
+ value={`chat:${row.kind}:${row.id}`}
+ testId={`quick-switch-chat-${row.id}`}
+ icon={row.kind === "voice" ? Mic : MessageSquare}
+ label={row.title || t("quick_switch.untitled_chat")}
+ detail={formatChatWhen(row.updatedMs)}
+ size={size}
+ onSelect={() => goToChat(row)}
+ />
+ ))}
+ </Command.Group>
+ )}
+ {paneHits.length > 0 && (
+ <Command.Group heading={t("quick_switch.group_terminals")} className={GROUP}>
+ {paneHits.map((pane) => (
+ <ResultRow
+ key={`${pane.workspace_id}:${pane.name}`}
+ value={`pane:${pane.workspace_id}:${pane.name}`}
+ testId={`quick-switch-pane-${pane.workspace_id}-${pane.name}`}
+ icon={SquareTerminal}
+ label={paneTitle(pane)}
+ detail={`${pane.key} · ${pane.workspace_name}`}
+ size={size}
+ onSelect={() => goToPane(pane)}
+ />
+ ))}
+ </Command.Group>
+ )}
+ {workspaceHits.length > 0 && (
+ <Command.Group heading={t("quick_switch.group_workspaces")} className={GROUP}>
+ {workspaceHits.map((workspace) => (
+ <ResultRow
+ key={workspace.id}
+ value={`workspace:${workspace.id}`}
+ testId={`quick-switch-workspace-${workspace.id}`}
+ icon={FolderOpen}
+ label={workspace.name}
+ detail={workspace.branch || folderName(workspace.folder)}
+ size={size}
+ onSelect={() => goToWorkspace(workspace)}
+ />
+ ))}
+ </Command.Group>
+ )}
+ {settingsMatches.length > 0 && (
+ <Command.Group heading={t("quick_switch.group_settings")} className={GROUP}>
+ {settingsMatches.map((match) => (
+ <ResultRow
+ key={match.id}
+ value={`setting:${match.id}`}
+ testId={`quick-switch-setting-${match.id}`}
+ icon={Settings2}
+ label={match.label}
+ detail={label("nav.settings", "Settings")}
+ size={size}
+ onSelect={() => goToSetting(match.id)}
+ />
+ ))}
+ </Command.Group>
+ )}
+ </Command.List>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/QuickSwitcher.test.tsx b/jarvis/ui/web/frontend/src/components/QuickSwitcher.test.tsx
index 52e20fdc65..9d4e2ff422 100644
--- a/jarvis/ui/web/frontend/src/components/QuickSwitcher.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/QuickSwitcher.test.tsx
@@ -2,7 +2,7 @@
* The quick switcher end to end: type, Enter, you are there.
*/
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
// Radix Dialog and cmdk touch browser APIs jsdom does not ship.
class ResizeObserverPolyfill {
@@ -158,6 +158,15 @@ describe("QuickSwitcher", () => {
expect(useIdeSidePanelStore.getState().spotlight).toEqual({ workspaceId: "ws-2", pane: "codex-3" });
});
+ it("selects the top row again when late results push in above it", async () => {
+ renderOpen();
+ // "blog" matches no section and no chat at first; the terminal arrives
+ // with the fetch and must become the selected top row, so Enter opens it.
+ fireEvent.change(screen.getByTestId("quick-switcher-input"), { target: { value: "blog speed" } });
+ const row = await screen.findByTestId("quick-switch-pane-ws-2-codex-3");
+ await waitFor(() => expect(row.getAttribute("data-selected")).toBe("true"));
+ });
+
it("opens with the text typed into the sidebar bar", () => {
render(<QuickSwitcher open onOpenChange={() => {}} initialQuery="agen" />);
expect((screen.getByTestId("quick-switcher-input") as HTMLInputElement).value).toBe("agen");
diff --git a/jarvis/ui/web/frontend/src/components/QuickSwitcher.tsx b/jarvis/ui/web/frontend/src/components/QuickSwitcher.tsx
index 25b3431916..4aeec23d2e 100644
--- a/jarvis/ui/web/frontend/src/components/QuickSwitcher.tsx
+++ b/jarvis/ui/web/frontend/src/components/QuickSwitcher.tsx
@@ -1,156 +1,24 @@
/**
- * The quick switcher — Ctrl+Space anywhere (or the search bar at the top of
- * the sidebar), type where you want to go, Enter.
+ * The quick switcher's Spotlight window — Ctrl+Space anywhere, type where you
+ * want to go, Enter.
*
* Modelled on the Mac's Spotlight bar: one large field floating high on the
* screen over a frosted panel, results directly underneath with the first one
- * already selected, the app still visible behind it (no dimming scrim). What it
- * lists and how it ranks lives in `@/lib/quickSwitch` (sections) and
- * `@/lib/quickSwitchSources` (chats, terminals, workspaces); this file draws it
- * and fetches the live lists once per opening.
+ * already selected, the app still visible behind it (no dimming scrim). The
+ * results themselves are `QuickSwitchList`, the same list the sidebar search
+ * field drops down under itself (`InlineQuickSwitch`).
*
- * cmdk drives the keyboard (arrows, Enter, the active row) with its own
- * filtering switched OFF — the ranking is ours and must not be re-scored
- * (the same reason WikiSearch turns it off). Radix Dialog owns Escape, the
- * focus trap and handing focus back to the pane or field you came from.
+ * Radix Dialog owns Escape, the focus trap and handing focus back to the pane
+ * or field you came from.
*/
import * as Dialog from "@radix-ui/react-dialog";
import { Command } from "cmdk";
-import {
- CornerDownLeft,
- FolderOpen,
- MessageSquare,
- Mic,
- Search,
- Settings2,
- SquareTerminal,
- type LucideIcon,
-} from "lucide-react";
-import { useEffect, useMemo, useState, type ReactNode } from "react";
-import { useT, useUiLanguage } from "@/i18n";
-import { useEventStore } from "@/store/events";
-import { useHomeStore } from "@/store/home";
-import { useSettingsJump } from "@/store/settingsJump";
-import { useIdeProjectsStore } from "@/store/ideProjects";
-import { useIdeSidePanelStore } from "@/store/ideSidePanel";
-import { formatChatWhen, useChatRows, type ChatRow } from "@/components/home/chatRows";
-import {
- fetchIdeProjects,
- fetchWorkspacePanes,
- type ProjectWorkspace,
- type WorkspacePaneRow,
-} from "@/lib/agenticIdeApi";
-import {
- ambiguousEntryKeys,
- rankQuickSwitch,
- strongSettingsMatches,
- type QuickSwitchEntry,
-} from "@/lib/quickSwitch";
-import { folderName, rankItems } from "@/lib/quickSwitchSources";
-import { searchSettingsOptions } from "@/views/settings/settingsSearch";
+import { CornerDownLeft, Search } from "lucide-react";
+import { useState } from "react";
+import { useT } from "@/i18n";
+import { QuickSwitchList } from "@/components/QuickSwitchList";
import { cn } from "@/lib/utils";
-/** Resolve a label, falling back when the key is missing (the resolver echoes it). */
-function useLabel() {
- const t = useT();
- return (key: string, fallback: string) => {
- const value = t(key);
- return value === key ? fallback : value;
- };
-}
-
-const ROW = cn(
- "group flex h-11 cursor-default select-none items-center gap-3 rounded-lg px-2.5",
- "text-base text-foreground outline-none",
- "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground",
-);
-
-const TILE = cn(
- "grid h-7 w-7 shrink-0 place-items-center rounded-md bg-secondary text-muted-foreground",
- "group-data-[selected=true]:bg-white/20 group-data-[selected=true]:text-accent-foreground",
-);
-
-const DETAIL = cn(
- "ml-auto shrink-0 truncate pl-3 text-sm text-muted-foreground",
- "group-data-[selected=true]:text-accent-foreground/80",
-);
-
-const GROUP = cn(
- "[&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-2.5",
- "[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
- "[&_[cmdk-group-heading]]:text-muted-foreground",
-);
-
-/** How many live results each group may show, so the sections stay in view. */
-const LIMIT = { chats: 6, terminals: 6, workspaces: 4, recentChats: 4 } as const;
-
-/** One result row: icon tile, a label that truncates, a quiet detail on the right. */
-function ResultRow({
- value,
- testId,
- icon: Icon,
- label,
- detail,
- onSelect,
-}: {
- value: string;
- testId: string;
- icon: LucideIcon;
- label: ReactNode;
- detail?: ReactNode;
- onSelect: () => void;
-}) {
- return (
- <Command.Item value={value} onSelect={onSelect} data-testid={testId} className={ROW}>
- <span className={TILE}>
- <Icon className="h-4 w-4" aria-hidden />
- </span>
- <span className="min-w-0 truncate">{label}</span>
- {detail ? <span className={DETAIL}>{detail}</span> : null}
- </Command.Item>
- );
-}
-
-/**
- * The open workspaces and their panes, fetched once each time the switcher
- * opens. A headless or older backend simply contributes nothing — the
- * switcher must never fail to open because the IDE is not there.
- */
-function useIdeResults(): { panes: WorkspacePaneRow[]; workspaces: ProjectWorkspace[] } {
- const [panes, setPanes] = useState<WorkspacePaneRow[]>([]);
- const [workspaces, setWorkspaces] = useState<ProjectWorkspace[]>([]);
- useEffect(() => {
- let live = true;
- fetchWorkspacePanes()
- .then((found) => {
- if (live) setPanes(found.panes.filter((pane) => !pane.archived));
- })
- .catch(() => {
- /* no IDE on this backend — no terminal results */
- });
- fetchIdeProjects()
- .then((found) => {
- if (!live) return;
- const open = found.projects.flatMap((project) =>
- project.workspaces.filter((workspace) => workspace.status === "open"),
- );
- setWorkspaces(open.sort((a, b) => b.last_active_at - a.last_active_at));
- })
- .catch(() => {
- /* no IDE on this backend — no workspace results */
- });
- return () => {
- live = false;
- };
- }, []);
- return { panes, workspaces };
-}
-
-/** What a terminal row is called: its title, else its last prompt, else its agent. */
-function paneTitle(pane: WorkspacePaneRow): string {
- return pane.recap || pane.last_prompt || pane.display_name || pane.key;
-}
-
export function QuickSwitcher({
open,
onOpenChange,
@@ -158,88 +26,19 @@ export function QuickSwitcher({
}: {
open: boolean;
onOpenChange: (open: boolean) => void;
- /** Text already typed into the sidebar search bar that opened this. */
+ /** Text to start with. */
initialQuery?: string;
}) {
const t = useT();
- const label = useLabel();
- const language = useUiLanguage();
- const activeSection = useEventStore((s) => s.activeSection);
- const setActiveSection = useEventStore((s) => s.setActiveSection);
- const setSurface = useHomeStore((s) => s.setSurface);
- const requestSettingsJump = useSettingsJump((s) => s.request);
- const activateWorkspace = useIdeProjectsStore((s) => s.activateWorkspace);
- const setSpotlight = useIdeSidePanelStore((s) => s.setSpotlight);
const [query, setQuery] = useState(initialQuery);
- const { rows: chatRows, open: openChat } = useChatRows();
- const { panes, workspaces } = useIdeResults();
- const typed = query.trim() !== "";
-
- // About forty destinations — ranked inline on every keystroke, no memo needed.
- const labelFor = (item: QuickSwitchEntry) => label(item.labelKey, item.fallbackLabel);
- const ranked = rankQuickSwitch(query, labelFor);
- const ambiguous = ambiguousEntryKeys(labelFor);
- const settingsMatches = useMemo(
- () => strongSettingsMatches(query, searchSettingsOptions(language, query, t)),
- [query, language, t],
- );
- // Nothing typed yet: the most recent chats, like Spotlight's recents.
- const chatHits = typed
- ? rankItems(query, chatRows, (row) => [row.title, row.preview], LIMIT.chats)
- : chatRows.slice(0, LIMIT.recentChats);
- const paneHits = typed
- ? rankItems(
- query,
- panes,
- (pane) => [pane.recap, pane.last_prompt, pane.display_name, pane.key, pane.workspace_name],
- LIMIT.terminals,
- )
- : [];
- const workspaceHits = typed
- ? rankItems(
- query,
- workspaces,
- (workspace) => [workspace.name, folderName(workspace.folder), workspace.branch],
- LIMIT.workspaces,
- )
- : [];
+ // Controlled so the top row can be re-selected when results arrive late.
+ const [selected, setSelected] = useState("");
const close = () => {
onOpenChange(false);
setQuery("");
};
- const go = (item: QuickSwitchEntry) => {
- if (item.surface) setSurface(item.surface);
- setActiveSection(item.section);
- close();
- };
-
- const goToChat = (row: ChatRow) => {
- openChat(row);
- close();
- };
-
- /** Bring the pane's workspace to the front and frame the pane in the grid. */
- const goToPane = (pane: WorkspacePaneRow) => {
- setActiveSection("agentic-ide");
- if (!pane.workspace_active) activateWorkspace(pane.workspace_id);
- setSpotlight({ workspaceId: pane.workspace_id, pane: pane.name });
- close();
- };
-
- const goToWorkspace = (workspace: ProjectWorkspace) => {
- setActiveSection("agentic-ide");
- if (!workspace.active) activateWorkspace(workspace.id);
- close();
- };
-
- const goToSetting = (groupId: string) => {
- requestSettingsJump(groupId);
- setActiveSection("settings");
- close();
- };
-
return (
<Dialog.Root
open={open}
@@ -265,7 +64,13 @@ export function QuickSwitcher({
style={{ backgroundColor: "hsl(var(--popover) / 0.86)" }}
>
<Dialog.Title className="sr-only">{t("quick_switch.title")}</Dialog.Title>
- <Command shouldFilter={false} loop label={t("quick_switch.title")}>
+ <Command
+ shouldFilter={false}
+ loop
+ label={t("quick_switch.title")}
+ value={selected}
+ onValueChange={setSelected}
+ >
<div className="flex items-center gap-3 px-4">
<Search className="h-6 w-6 shrink-0 text-muted-foreground" aria-hidden />
<Command.Input
@@ -277,96 +82,12 @@ export function QuickSwitcher({
className="h-14 flex-1 bg-transparent text-2xl font-light text-foreground outline-none placeholder:text-muted-foreground"
/>
</div>
- <Command.List className="max-h-[min(30rem,62dvh)] overflow-y-auto border-t border-border p-1.5 scrollbar-jarvis">
- <Command.Empty className="px-3 py-6 text-center text-base text-muted-foreground">
- {t("quick_switch.no_results")}
- </Command.Empty>
- {ranked.length > 0 && (
- <Command.Group heading={t("quick_switch.group_sections")} className={GROUP}>
- {ranked.map(({ entry: item, label: text }) => {
- const here = item.section === activeSection && !item.surface;
- const area = item.parentLabelKey ? label(item.parentLabelKey, "") : "";
- // A label two rows share names its area up front, e.g.
- // "Voice › API Keys" beside the API Keys page itself.
- const shown = area && ambiguous.has(item.key) ? `${area} › ${text}` : text;
- return (
- <ResultRow
- key={item.key}
- value={`section:${item.key}`}
- testId={`quick-switch-${item.key}`}
- icon={item.icon}
- label={shown}
- detail={here ? t("quick_switch.current") : shown === text ? area : ""}
- onSelect={() => go(item)}
- />
- );
- })}
- </Command.Group>
- )}
- {chatHits.length > 0 && (
- <Command.Group
- heading={t(typed ? "quick_switch.group_chats" : "quick_switch.group_recent_chats")}
- className={GROUP}
- >
- {chatHits.map((row) => (
- <ResultRow
- key={`${row.kind}:${row.id}`}
- value={`chat:${row.kind}:${row.id}`}
- testId={`quick-switch-chat-${row.id}`}
- icon={row.kind === "voice" ? Mic : MessageSquare}
- label={row.title || t("quick_switch.untitled_chat")}
- detail={formatChatWhen(row.updatedMs)}
- onSelect={() => goToChat(row)}
- />
- ))}
- </Command.Group>
- )}
- {paneHits.length > 0 && (
- <Command.Group heading={t("quick_switch.group_terminals")} className={GROUP}>
- {paneHits.map((pane) => (
- <ResultRow
- key={`${pane.workspace_id}:${pane.name}`}
- value={`pane:${pane.workspace_id}:${pane.name}`}
- testId={`quick-switch-pane-${pane.workspace_id}-${pane.name}`}
- icon={SquareTerminal}
- label={paneTitle(pane)}
- detail={`${pane.key} · ${pane.workspace_name}`}
- onSelect={() => goToPane(pane)}
- />
- ))}
- </Command.Group>
- )}
- {workspaceHits.length > 0 && (
- <Command.Group heading={t("quick_switch.group_workspaces")} className={GROUP}>
- {workspaceHits.map((workspace) => (
- <ResultRow
- key={workspace.id}
- value={`workspace:${workspace.id}`}
- testId={`quick-switch-workspace-${workspace.id}`}
- icon={FolderOpen}
- label={workspace.name}
- detail={workspace.branch || folderName(workspace.folder)}
- onSelect={() => goToWorkspace(workspace)}
- />
- ))}
- </Command.Group>
- )}
- {settingsMatches.length > 0 && (
- <Command.Group heading={t("quick_switch.group_settings")} className={GROUP}>
- {settingsMatches.map((match) => (
- <ResultRow
- key={match.id}
- value={`setting:${match.id}`}
- testId={`quick-switch-setting-${match.id}`}
- icon={Settings2}
- label={match.label}
- detail={label("nav.settings", "Settings")}
- onSelect={() => goToSetting(match.id)}
- />
- ))}
- </Command.Group>
- )}
- </Command.List>
+ <QuickSwitchList
+ query={query}
+ onDone={close}
+ onFirstChange={setSelected}
+ className="max-h-[min(30rem,62dvh)] border-t border-border"
+ />
<div className="flex items-center justify-end gap-4 border-t border-border px-4 py-2 text-xs text-muted-foreground">
<span className="inline-flex items-center gap-1.5">
<kbd className="inline-flex h-5 items-center rounded border border-border px-1 font-sans">
diff --git a/jarvis/ui/web/frontend/src/components/layout/InlineQuickSwitch.test.tsx b/jarvis/ui/web/frontend/src/components/layout/InlineQuickSwitch.test.tsx
new file mode 100644
index 0000000000..1de8a58bb5
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/layout/InlineQuickSwitch.test.tsx
@@ -0,0 +1,74 @@
+/**
+ * The sidebar search field: typing drops the results down under it, Enter
+ * opens the top one, Escape clears then closes.
+ */
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+
+class ResizeObserverPolyfill {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+}
+if (typeof (globalThis as { ResizeObserver?: unknown }).ResizeObserver === "undefined") {
+ (globalThis as unknown as { ResizeObserver: typeof ResizeObserverPolyfill }).ResizeObserver =
+ ResizeObserverPolyfill;
+}
+if (typeof Element !== "undefined" && !("scrollIntoView" in Element.prototype)) {
+ // @ts-expect-error -- jsdom shim
+ Element.prototype.scrollIntoView = () => {};
+}
+
+import { InlineQuickSwitch } from "./InlineQuickSwitch";
+import { useEventStore } from "@/store/events";
+
+function renderField(initialValue = "") {
+ render(
+ <InlineQuickSwitch
+ initialValue={initialValue}
+ autoFocus={false}
+ accessibleName="Search George"
+ placeholder="Search"
+ caps={["Ctrl", "Space"]}
+ />,
+ );
+ return screen.getByTestId("sidebar-search") as HTMLInputElement;
+}
+
+describe("InlineQuickSwitch", () => {
+ beforeEach(() => useEventStore.getState().setActiveSection("chats"));
+ afterEach(cleanup);
+
+ it("stays closed until focused", () => {
+ renderField();
+ expect(screen.queryByTestId("sidebar-search-results")).toBeNull();
+ });
+
+ it("drops the results down under the field and opens the top one on Enter", () => {
+ const input = renderField();
+ fireEvent.focus(input);
+ fireEvent.change(input, { target: { value: "agentic" } });
+ expect(screen.getByTestId("sidebar-search-results")).toBeTruthy();
+ expect(screen.getByTestId("quick-switch-agentic-ide")).toBeTruthy();
+ fireEvent.keyDown(input, { key: "Enter" });
+ expect(useEventStore.getState().activeSection).toBe("agentic-ide");
+ expect(input.value).toBe("");
+ expect(screen.queryByTestId("sidebar-search-results")).toBeNull();
+ });
+
+ it("clears on the first Escape and closes on the second", () => {
+ const input = renderField();
+ fireEvent.focus(input);
+ fireEvent.change(input, { target: { value: "set" } });
+ fireEvent.keyDown(input, { key: "Escape" });
+ expect(input.value).toBe("");
+ expect(screen.getByTestId("sidebar-search-results")).toBeTruthy();
+ fireEvent.keyDown(input, { key: "Escape" });
+ expect(screen.queryByTestId("sidebar-search-results")).toBeNull();
+ });
+
+ it("keeps what was typed before it loaded", () => {
+ const input = renderField("blo");
+ expect(input.value).toBe("blo");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/layout/InlineQuickSwitch.tsx b/jarvis/ui/web/frontend/src/components/layout/InlineQuickSwitch.tsx
new file mode 100644
index 0000000000..3579bdea77
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/layout/InlineQuickSwitch.tsx
@@ -0,0 +1,172 @@
+/**
+ * The sidebar search field, live: type into it and the results drop down
+ * right under it — no window in the middle of the screen. The Spotlight
+ * window stays the chord's job (Ctrl+Space); both show the same
+ * `QuickSwitchList`.
+ *
+ * Lazy on purpose: the result list carries every locale for its
+ * cross-language search, and the sidebar is in the startup chunk. Until this
+ * loads, `SidebarSearchBar` draws a plain field that looks identical.
+ *
+ * The dropdown is portalled to <body> with fixed coordinates taken from the
+ * field, so it can be wider than the sidebar and no section's own layer can
+ * cover it. cmdk only looks for its rows inside its list element, so the
+ * portal does not break the arrow keys. A mousedown on the dropdown is
+ * swallowed so the field keeps focus while a row is clicked.
+ */
+import { Command } from "cmdk";
+import { Search } from "lucide-react";
+import { useCallback, useLayoutEffect, useRef, useState, type ReactNode } from "react";
+import { createPortal } from "react-dom";
+import { useT } from "@/i18n";
+import { QuickSwitchList } from "@/components/QuickSwitchList";
+import { cn } from "@/lib/utils";
+
+/** The dropdown is at least this wide even under a narrow sidebar. */
+const PANEL_MIN_WIDTH = 420;
+const VIEWPORT_GUTTER = 16;
+
+export interface InlineQuickSwitchProps {
+ initialValue: string;
+ autoFocus: boolean;
+ accessibleName: string;
+ placeholder: string;
+ status?: ReactNode;
+ caps: string[];
+ /** Keeps the plain fallback field in step with what is typed here. */
+ onValueChange?: (value: string) => void;
+}
+
+export function InlineQuickSwitch({
+ initialValue,
+ autoFocus,
+ accessibleName,
+ placeholder,
+ status,
+ caps,
+ onValueChange,
+}: InlineQuickSwitchProps) {
+ const t = useT();
+ const fieldRef = useRef<HTMLDivElement>(null);
+ const inputRef = useRef<HTMLInputElement>(null);
+ const [query, setQuery] = useState(initialValue);
+ const [open, setOpen] = useState(autoFocus);
+ const [rect, setRect] = useState<DOMRect | null>(null);
+ // Controlled so the top row can be re-selected when results arrive late.
+ const [selected, setSelected] = useState("");
+
+ const setValue = (value: string) => {
+ setQuery(value);
+ onValueChange?.(value);
+ setOpen(true);
+ };
+
+ const measure = useCallback(() => {
+ if (fieldRef.current) setRect(fieldRef.current.getBoundingClientRect());
+ }, []);
+
+ useLayoutEffect(() => {
+ if (!open) return;
+ measure();
+ window.addEventListener("resize", measure);
+ return () => window.removeEventListener("resize", measure);
+ }, [open, measure]);
+
+ // Typed into the plain field before this loaded: keep the caret at the end.
+ useLayoutEffect(() => {
+ const input = inputRef.current;
+ if (autoFocus && input) {
+ input.focus();
+ input.setSelectionRange(input.value.length, input.value.length);
+ }
+ }, [autoFocus]);
+
+ const finish = () => {
+ setValue("");
+ setOpen(false);
+ inputRef.current?.blur();
+ };
+
+ const width = rect
+ ? Math.min(Math.max(rect.width, PANEL_MIN_WIDTH), window.innerWidth - rect.left - VIEWPORT_GUTTER)
+ : PANEL_MIN_WIDTH;
+
+ return (
+ <Command
+ shouldFilter={false}
+ loop
+ label={accessibleName}
+ value={selected}
+ onValueChange={setSelected}
+ className="min-w-0 flex-1"
+ >
+ <div
+ ref={fieldRef}
+ className={cn(
+ "flex h-8 w-full items-center gap-2 rounded-lg border px-2.5 text-sm transition-colors",
+ open
+ ? "border-accent bg-card ring-2 ring-ring"
+ : "border-border bg-input hover:border-border-strong",
+ )}
+ >
+ <Search className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
+ <Command.Input
+ ref={inputRef}
+ value={query}
+ onValueChange={setValue}
+ onFocus={() => setOpen(true)}
+ onBlur={() => setOpen(false)}
+ onKeyDown={(event) => {
+ if (event.key !== "Escape") return;
+ event.preventDefault();
+ if (query) setValue("");
+ else finish();
+ }}
+ placeholder={placeholder}
+ aria-label={accessibleName}
+ title={accessibleName}
+ data-testid="sidebar-search"
+ className="h-full min-w-0 flex-1 bg-transparent text-foreground outline-none placeholder:text-muted-foreground"
+ />
+ {status}
+ {!open && caps.length > 0 && (
+ <span className="hidden shrink-0 items-center gap-0.5 sm:inline-flex" aria-hidden>
+ {caps.map((cap) => (
+ <kbd
+ key={cap}
+ className="rounded border border-border bg-background px-1 font-sans text-[10px] leading-4 text-muted-foreground"
+ >
+ {cap}
+ </kbd>
+ ))}
+ </span>
+ )}
+ </div>
+ {open &&
+ rect &&
+ createPortal(
+ <div
+ data-testid="sidebar-search-results"
+ onMouseDown={(event) => event.preventDefault()}
+ className={cn(
+ "fixed z-[70] overflow-hidden rounded-xl border border-border bg-popover shadow-float",
+ "animate-in fade-in-0 zoom-in-95 duration-100 motion-reduce:animate-none",
+ )}
+ style={{ top: rect.bottom + 6, left: rect.left, width }}
+ >
+ <QuickSwitchList
+ query={query}
+ onDone={finish}
+ size="compact"
+ onFirstChange={setSelected}
+ className="max-h-[min(28rem,70dvh)]"
+ />
+ <p className="border-t border-border px-3 py-1.5 text-xs text-muted-foreground">
+ {t("quick_switch.inline_hint")}
+ </p>
+ </div>,
+ document.body,
+ )}
+ </Command>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
index cbc8a7d8ec..0f8aecace7 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
@@ -349,15 +349,13 @@ describe("Sidebar assistant name header", () => {
expect(bar()).not.toContain("Nova");
});
- test("the search bar opens the quick switcher with the typed key", () => {
+ test("the search bar is a field you type into, not a door to a window", () => {
renderSidebar();
- const bar = screen.getByTestId("sidebar-search");
- fireEvent.keyDown(bar, { key: "a" });
- expect(useQuickSwitcher.getState()).toMatchObject({ open: true, initialQuery: "a" });
- act(() => useQuickSwitcher.getState().hide());
- fireEvent.click(bar);
- expect(useQuickSwitcher.getState()).toMatchObject({ open: true, initialQuery: "" });
- act(() => useQuickSwitcher.getState().hide());
+ const bar = screen.getByTestId("sidebar-search") as HTMLInputElement;
+ fireEvent.change(bar, { target: { value: "agen" } });
+ expect(bar.value).toBe("agen");
+ // Typing here never opens the Spotlight window in the middle.
+ expect(useQuickSwitcher.getState().open).toBe(false);
});
test("switching the quick switcher off brings the name row back", () => {
diff --git a/jarvis/ui/web/frontend/src/components/layout/SidebarSearchBar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/SidebarSearchBar.test.tsx
new file mode 100644
index 0000000000..39c460f577
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/layout/SidebarSearchBar.test.tsx
@@ -0,0 +1,57 @@
+/**
+ * The sidebar search field swaps its plain stand-in for the live field once
+ * the app has settled — without a render loop, and keeping what was typed.
+ */
+import { afterEach, describe, expect, it } from "vitest";
+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+
+class ResizeObserverPolyfill {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+}
+if (typeof (globalThis as { ResizeObserver?: unknown }).ResizeObserver === "undefined") {
+ (globalThis as unknown as { ResizeObserver: typeof ResizeObserverPolyfill }).ResizeObserver =
+ ResizeObserverPolyfill;
+}
+
+import { SidebarSearchBar } from "./SidebarSearchBar";
+import { useEventStore } from "@/store/events";
+
+describe("SidebarSearchBar", () => {
+ afterEach(cleanup);
+
+ it("loads the live field on focus and keeps the typed text", async () => {
+ let renders = 0;
+ function Probe() {
+ renders += 1;
+ return <SidebarSearchBar assistantName="George" status={<span />} />;
+ }
+ render(<Probe />);
+ const plain = screen.getByTestId("sidebar-search") as HTMLInputElement;
+ expect(plain.closest("[cmdk-root]")).toBeNull();
+ fireEvent.change(plain, { target: { value: "blo" } });
+ fireEvent.focus(plain);
+ // The live field is a lazy chunk; its first import is slow under test.
+ await waitFor(() => expect(document.querySelector("[cmdk-root]")).not.toBeNull(), {
+ timeout: 8000,
+ });
+ const live = screen.getByTestId("sidebar-search") as HTMLInputElement;
+ expect(live.value).toBe("blo");
+ // Let any effect chain settle; a render loop would keep counting.
+ await act(async () => {
+ await new Promise((resolve) => setTimeout(resolve, 200));
+ });
+ const settled = renders;
+ await act(async () => {
+ await new Promise((resolve) => setTimeout(resolve, 200));
+ });
+ expect(renders).toBe(settled);
+ }, 15000);
+
+ it("names the assistant in its accessible name", () => {
+ useEventStore.setState({ assistantName: "George" });
+ render(<SidebarSearchBar assistantName="George" />);
+ expect(screen.getByTestId("sidebar-search").getAttribute("aria-label")).toContain("George");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/layout/SidebarSearchBar.tsx b/jarvis/ui/web/frontend/src/components/layout/SidebarSearchBar.tsx
index abc31eca5e..20b27531d0 100644
--- a/jarvis/ui/web/frontend/src/components/layout/SidebarSearchBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/SidebarSearchBar.tsx
@@ -1,83 +1,108 @@
/**
- * The search bar at the top of the sidebar — the visible door into the quick
- * switcher, in the spot the assistant's name row used to take.
+ * The search field at the top of the sidebar, in the spot the assistant's
+ * name row used to take. You type straight into it and the results drop down
+ * under it (`InlineQuickSwitch`); the Spotlight window in the middle of the
+ * screen is the chord's, not this field's.
*
- * It reads and behaves like a search field: click it, press Enter or an arrow,
- * or simply start typing while it has focus. The first character typed opens
- * the switcher with that character already in its field, so a fast typist
- * loses nothing. It reads "Search": the assistant's name beside the chord hint
- * and the voice dot was cut to "Search Ge…" at the default width. The
- * accessible name still says what is searched ("Search George"). The voice
- * status dot (plus the dev-instance tag) sits at its right edge.
+ * The live field is a lazy chunk (its result list carries every locale), so
+ * this draws a plain field that looks the same until it is needed. It is
+ * fetched once the app has settled, or the moment the field is pointed at or
+ * focused — whichever comes first — and whatever was typed meanwhile is
+ * handed over with the caret still at the end.
*
- * A button rather than a real <input>: the switcher's own field is where text
- * is edited, and a second editable field that hands its text over on every
- * key would fight it for focus. `role="search"` keeps it a search landmark.
+ * It reads "Search": the assistant's name beside the chord hint and the voice
+ * dot was cut to "Search Ge…" at the default width. The accessible name still
+ * says what is searched ("Search George"). The voice status dot (plus the
+ * dev-instance tag) sits at its right edge.
*/
-import type { ReactNode } from "react";
+import { Suspense, lazy, useEffect, useState, type ReactNode } from "react";
import { Search } from "lucide-react";
import { useT } from "@/i18n";
-import { useQuickSwitcher } from "@/store/quickSwitcher";
import { useQuickSwitchSettings } from "@/store/quickSwitchSettings";
import { chordCaps } from "@/lib/quickSwitchChord";
-import { cn } from "@/lib/utils";
+
+const loadInline = () =>
+ import("@/components/layout/InlineQuickSwitch").then((m) => ({ default: m.InlineQuickSwitch }));
+const InlineQuickSwitch = lazy(loadInline);
+
+/** How long after mount the live field is fetched without being asked for. */
+const IDLE_LOAD_MS = 2500;
export function SidebarSearchBar({
assistantName,
status,
}: {
assistantName: string;
- /** The voice dot / spinner and the dev tag, drawn at the bar's right edge. */
+ /** The voice dot / spinner and the dev tag, drawn at the field's right edge. */
status?: ReactNode;
}) {
const t = useT();
- const show = useQuickSwitcher((s) => s.show);
const combo = useQuickSwitchSettings((s) => s.combo);
const caps = combo ? chordCaps(combo) : [];
const accessibleName = t("quick_switch.sidebar_placeholder").replace("{name}", assistantName);
+ const placeholder = t("quick_switch.sidebar_search");
+ const [armed, setArmed] = useState(false);
+ const [focused, setFocused] = useState(false);
+ const [text, setText] = useState("");
- return (
- <div role="search" className="min-w-0 flex-1">
- <button
- type="button"
- data-testid="sidebar-search"
+ useEffect(() => {
+ const timer = window.setTimeout(() => setArmed(true), IDLE_LOAD_MS);
+ return () => window.clearTimeout(timer);
+ }, []);
+
+ const plain = (
+ <div className="flex h-8 min-w-0 flex-1 items-center gap-2 rounded-lg border border-border bg-input px-2.5 text-sm">
+ <Search className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
+ <input
+ type="text"
+ value={text}
+ onChange={(event) => setText(event.target.value)}
+ onFocus={() => {
+ setFocused(true);
+ setArmed(true);
+ }}
+ onPointerEnter={() => setArmed(true)}
+ placeholder={placeholder}
aria-label={accessibleName}
title={accessibleName}
- onClick={() => show()}
- onKeyDown={(event) => {
- if (event.ctrlKey || event.metaKey || event.altKey) return;
- // A printable key opens the switcher with that key already typed.
- if (event.key.length === 1 && event.key !== " ") {
- event.preventDefault();
- show(event.key);
- } else if (event.key === "ArrowDown") {
- event.preventDefault();
- show();
- }
- }}
- className={cn(
- "group flex h-8 w-full items-center gap-2 rounded-lg border border-border bg-secondary/60 px-2.5",
- "text-left text-sm text-muted-foreground transition-colors",
- "hover:border-border-strong hover:bg-secondary hover:text-foreground",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- )}
- >
- <Search className="h-3.5 w-3.5 shrink-0" aria-hidden />
- <span className="min-w-0 flex-1 truncate">{t("quick_switch.sidebar_search")}</span>
- {status}
- {caps.length > 0 && (
- <span className="hidden shrink-0 items-center gap-0.5 sm:inline-flex" aria-hidden>
- {caps.map((cap) => (
- <kbd
- key={cap}
- className="rounded border border-border bg-background px-1 font-sans text-[10px] leading-4 text-muted-foreground"
- >
- {cap}
- </kbd>
- ))}
- </span>
- )}
- </button>
+ data-testid="sidebar-search"
+ autoComplete="off"
+ spellCheck={false}
+ className="h-full min-w-0 flex-1 bg-transparent text-foreground outline-none placeholder:text-muted-foreground"
+ />
+ {status}
+ {caps.length > 0 && (
+ <span className="hidden shrink-0 items-center gap-0.5 sm:inline-flex" aria-hidden>
+ {caps.map((cap) => (
+ <kbd
+ key={cap}
+ className="rounded border border-border bg-background px-1 font-sans text-[10px] leading-4 text-muted-foreground"
+ >
+ {cap}
+ </kbd>
+ ))}
+ </span>
+ )}
+ </div>
+ );
+
+ return (
+ <div role="search" className="flex min-w-0 flex-1">
+ {armed ? (
+ <Suspense fallback={plain}>
+ <InlineQuickSwitch
+ initialValue={text}
+ autoFocus={focused}
+ accessibleName={accessibleName}
+ placeholder={placeholder}
+ status={status}
+ caps={caps}
+ onValueChange={setText}
+ />
+ </Suspense>
+ ) : (
+ plain
+ )}
</div>
);
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index e31d0e7dbc..8dca0b3e61 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -1631,6 +1631,7 @@
"terminal_grid": "Terminal-Raster",
"sidebar_placeholder": "{name} durchsuchen",
"sidebar_search": "Suchen",
+ "inline_hint": "↑ ↓ auswählen · Enter öffnen · Esc schließen",
"group_chats": "Chats",
"group_recent_chats": "Letzte Chats",
"group_terminals": "Terminals",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index c35ac9d5b9..d30ce8a954 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -1664,6 +1664,7 @@
"terminal_grid": "Terminal grid",
"sidebar_placeholder": "Search {name}",
"sidebar_search": "Search",
+ "inline_hint": "↑ ↓ to choose · Enter to open · Esc to close",
"group_chats": "Chats",
"group_recent_chats": "Recent chats",
"group_terminals": "Terminals",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index d21fa38ec2..5e9be64309 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -1631,6 +1631,7 @@
"terminal_grid": "Cuadrícula de terminales",
"sidebar_placeholder": "Buscar en {name}",
"sidebar_search": "Buscar",
+ "inline_hint": "↑ ↓ elegir · Enter abrir · Esc cerrar",
"group_chats": "Chats",
"group_recent_chats": "Chats recientes",
"group_terminals": "Terminales",