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(web-ui): replace native selects with the themed dropdown everywhere

rubenluetke10-beep0ada8f7a6930
diff --git a/jarvis/ui/web/frontend/src/components/ProviderSwitcher.tsx b/jarvis/ui/web/frontend/src/components/ProviderSwitcher.tsx
index ddcf48dd54..a93fe18266 100644
--- a/jarvis/ui/web/frontend/src/components/ProviderSwitcher.tsx
+++ b/jarvis/ui/web/frontend/src/components/ProviderSwitcher.tsx
@@ -1,5 +1,6 @@
import { useState } from "react";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { switchBrainProvider, useProviders } from "@/hooks/useProviders";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
@@ -49,18 +50,20 @@ export function ProviderSwitcher() {
<label className="text-xs uppercase tracking-wide text-muted-foreground">
Active Brain
</label>
- <select
+ <BrandedSelect
value={choice}
- onChange={(e) => setTarget(e.target.value)}
- className="w-full rounded-md border border-input bg-background px-3 py-2 text-sm"
- >
- {brainProviders.map((p) => (
- <option key={p.id} value={p.id} disabled={!p.configured}>
- {p.label}
- {!p.configured && ` — ${t("provider_switcher.no_credential")}`}
- </option>
- ))}
- </select>
+ onValueChange={setTarget}
+ ariaLabel="Active Brain"
+ options={brainProviders.map((provider) => ({
+ value: provider.id,
+ label: `${provider.label}${
+ provider.configured
+ ? ""
+ : ` — ${t("provider_switcher.no_credential")}`
+ }`,
+ disabled: !provider.configured,
+ }))}
+ />
<Button onClick={handleApply} disabled={pending} className="w-full">
{pending ? "Switching…" : "Apply"}
</Button>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.test.tsx
index 7ae32b8a10..9e9803ab5f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.test.tsx
@@ -230,14 +230,14 @@ describe("AgentAllocation", () => {
expect(screen.getByText("2 / 5")).toBeTruthy();
});
- it("applies one selected subscription to every terminal of an agent", () => {
+ it("applies one selected subscription to every terminal of an agent", async () => {
render(<Harness count={3} accounts={ACCOUNTS} />);
fireEvent.click(screen.getAllByRole("button", { name: "All" })[0]);
- fireEvent.change(
+ fireEvent.click(
screen.getByRole("combobox", { name: "Subscription for Claude Code" }),
- { target: { value: "claude:work" } },
);
+ fireEvent.click(await screen.findByText("Work seat"));
expect(plan().map((pane) => pane.account)).toEqual([
"claude:work",
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.tsx
index 982fc38e2b..52f50652ca 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.tsx
@@ -8,7 +8,8 @@ import { cn } from "@/lib/utils";
import type { AgentAccount } from "@/lib/agentAccountsApi";
import type { AgentStatus } from "@/lib/agenticIdeApi";
import { AgentMark } from "./AgentMark";
-import { Button, Select, SectionLabel } from "./controls";
+import { Button, SectionLabel } from "./controls";
+import { BrandedSelect } from "@/components/ui/select";
export interface PlannedTerminal {
agent: string;
@@ -305,31 +306,32 @@ export function AgentAllocation({
{accounts.length >= 2 && count > 0 && (
<label className="mt-2 flex max-w-sm items-center gap-2 text-[11px] text-muted-foreground">
<span>{t("workspace_launcher.agents.account")}</span>
- <Select
+ <BrandedSelect
value={selectedAccount}
- aria-label={t(
+ ariaLabel={t(
"workspace_launcher.agents.account_for",
).replace("{0}", agent.display_name)}
- onChange={(event) =>
- setAccount(
- agent.name,
- event.target.value || undefined,
- )
+ onValueChange={(value) =>
+ setAccount(agent.name, value || undefined)
}
className="h-7 min-w-0 flex-1 text-xs"
- >
- <option value="">
- {t("workspace_launcher.agents.active_account")}
- </option>
- {accounts.map((account) => (
- <option key={account.id} value={account.id}>
- {account.label}
- {account.connected
- ? ""
- : ` (${t("workspace_launcher.agents.not_signed_in")})`}
- </option>
- ))}
- </Select>
+ options={[
+ {
+ value: "",
+ label: t(
+ "workspace_launcher.agents.active_account",
+ ),
+ },
+ ...accounts.map((account) => ({
+ value: account.id,
+ label: `${account.label}${
+ account.connected
+ ? ""
+ : ` (${t("workspace_launcher.agents.not_signed_in")})`
+ }`,
+ })),
+ ]}
+ />
</label>
)}
</div>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.test.tsx
index 009386b976..9cfca6483f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.test.tsx
@@ -78,6 +78,90 @@ describe("AgentPickerMenu", () => {
});
});
+/**
+ * A terminal pane is `overflow-hidden` by necessity — xterm's canvas must not
+ * paint past the frame — so a menu positioned inside one is cut off at its
+ * edge. In a twelve-pane wall that left a sliver of the first entry and nothing
+ * to pick from. Detached, the menu is measured against the bar it belongs to
+ * and drawn in front of the window instead.
+ */
+describe("AgentPickerMenu anchored outside its caller", () => {
+ const VIEWPORT = { width: 1024, height: 768 };
+
+ function AnchoredHarness({ rect }: { rect: { top: number; bottom: number; right: number } }) {
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null);
+ return (
+ <div
+ data-testid="anchor"
+ ref={(node) => {
+ if (!node || anchor) return;
+ node.getBoundingClientRect = () =>
+ ({
+ ...rect,
+ left: rect.right - 300,
+ width: 300,
+ height: rect.bottom - rect.top,
+ }) as DOMRect;
+ setAnchor(node);
+ }}
+ >
+ {anchor && (
+ <AgentPickerMenu
+ title="Open what?"
+ ariaLabel="Choose a terminal"
+ agents={[{ name: "codex", displayName: "Codex", installed: true }]}
+ onPick={vi.fn()}
+ onDismiss={vi.fn()}
+ testId="picker"
+ itemTestId={(agent) => `pick-${agent}`}
+ className="right-2 top-full mt-1"
+ anchorTo={anchor}
+ />
+ )}
+ </div>
+ );
+ }
+
+ it("hangs under the anchor, right-aligned, and drops the caller's inset classes", () => {
+ window.innerWidth = VIEWPORT.width;
+ window.innerHeight = VIEWPORT.height;
+ render(<AnchoredHarness rect={{ top: 100, bottom: 130, right: 700 }} />);
+
+ const menu = screen.getByTestId("picker");
+ expect(menu.dataset.detached).toBe("true");
+ expect(menu.style.position).toBe("fixed");
+ expect(parseFloat(menu.style.top)).toBeGreaterThan(130);
+ // Right edge on the anchor's right edge: that is where the buttons that
+ // open it sit.
+ expect(parseFloat(menu.style.left) + parseFloat(menu.style.width)).toBe(700);
+ // The caller's anchoring describes a box INSIDE its own element, which is
+ // the very thing a detached menu is escaping.
+ expect(menu.className).not.toContain("top-full");
+ expect(menu.className).not.toContain("absolute");
+ });
+
+ it("flips above the anchor when a pane sits at the bottom of the screen", () => {
+ window.innerWidth = VIEWPORT.width;
+ window.innerHeight = VIEWPORT.height;
+ render(<AnchoredHarness rect={{ top: 700, bottom: 730, right: 700 }} />);
+
+ const menu = screen.getByTestId("picker");
+ expect(parseFloat(menu.style.top)).toBeLessThan(700);
+ expect(parseFloat(menu.style.maxHeight)).toBeGreaterThan(0);
+ });
+
+ it("keeps a menu opened near the right edge inside the window", () => {
+ window.innerWidth = VIEWPORT.width;
+ window.innerHeight = VIEWPORT.height;
+ render(<AnchoredHarness rect={{ top: 100, bottom: 130, right: 1024 }} />);
+
+ const menu = screen.getByTestId("picker");
+ expect(
+ parseFloat(menu.style.left) + parseFloat(menu.style.width),
+ ).toBeLessThanOrEqual(VIEWPORT.width);
+ });
+});
+
describe("offersAgentChoice", () => {
it("only offers a menu when more than one choice is actually installed", () => {
expect(offersAgentChoice(undefined)).toBe(false);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx
index 7b3a5b5e2e..fe6e6c5718 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx
@@ -21,6 +21,8 @@
* this side. An entry that is not installed stays listed but disabled, so the
* absence is visible and explains itself rather than silently not being there.
*/
+import { useEffect, useState } from "react";
+import { createPortal } from "react-dom";
import { cn } from "@/lib/utils";
/** A coding CLI an "open a terminal" action may start. */
@@ -51,6 +53,38 @@ export function offersAgentChoice(agents?: SplitAgentChoice[]): boolean {
return (agents ?? []).filter((a) => a.installed).length > 1;
}
+/** The menu's own footprint, used to decide whether it still fits below. */
+const MENU_WIDTH_PX = 240;
+const MENU_GAP_PX = 4;
+/** Never hang closer than this to a window edge. */
+const VIEWPORT_MARGIN_PX = 8;
+
+type FixedPlacement = { left: number; top: number; maxHeight: number };
+
+/**
+ * Where a detached menu hangs, measured from the element it belongs to.
+ *
+ * Right-aligned with the anchor, because that is where the buttons that open
+ * it sit, and flipped above it when the space below is the shorter of the two.
+ * Both numbers are clamped into the window: a pane in the last column would
+ * otherwise put half the menu past the right edge, where it is unreachable.
+ */
+function placeMenu(rect: DOMRect, viewport: { width: number; height: number }): FixedPlacement {
+ const below = viewport.height - rect.bottom - MENU_GAP_PX - VIEWPORT_MARGIN_PX;
+ const above = rect.top - MENU_GAP_PX - VIEWPORT_MARGIN_PX;
+ const dropsDown = below >= above;
+ const maxHeight = Math.max(96, Math.min(dropsDown ? below : above, viewport.height * 0.7));
+ const left = Math.max(
+ VIEWPORT_MARGIN_PX,
+ Math.min(rect.right - MENU_WIDTH_PX, viewport.width - MENU_WIDTH_PX - VIEWPORT_MARGIN_PX),
+ );
+ return {
+ left,
+ top: dropsDown ? rect.bottom + MENU_GAP_PX : Math.max(VIEWPORT_MARGIN_PX, rect.top - MENU_GAP_PX - maxHeight),
+ maxHeight,
+ };
+}
+
export function AgentPickerMenu({
title,
ariaLabel,
@@ -60,6 +94,7 @@ export function AgentPickerMenu({
testId,
itemTestId,
className,
+ anchorTo,
}: {
/** The line above the entries — "Open beside — what?". */
title: string;
@@ -72,9 +107,68 @@ export function AgentPickerMenu({
itemTestId: (agent: string) => string;
/** Where the menu hangs — the caller owns the anchoring. */
className?: string;
+ /**
+ * Hang the menu off this element, through a portal, instead of inside the
+ * caller's own box.
+ *
+ * For surfaces that CLIP: a terminal pane is `overflow-hidden` (it has to be
+ * — xterm's canvas must not paint past the frame), so a menu positioned
+ * inside one is cut off at the pane's edge, and a pane six rows tall showed
+ * a sliver of the first entry and nothing else. Rendering into the body puts
+ * the list back in front of the window rather than inside a box the size of
+ * the thing it was opened from. Absent, the menu stays where it always was.
+ */
+ anchorTo?: HTMLElement | null;
}) {
const first = agents.find((a) => a.installed);
- return (
+ const [placement, setPlacement] = useState<FixedPlacement | null>(null);
+
+ /*
+ * Re-measure while the menu is open, not once when it opened.
+ *
+ * The pane it hangs off is in a grid that moves: a seam being dragged, a
+ * sibling closing, the window resized. A menu that kept its opening
+ * coordinates would drift away from the button that spawned it. Passive
+ * capture on scroll, so a scroller anywhere between here and the body counts.
+ */
+ useEffect(() => {
+ if (!anchorTo) return;
+ const measure = () =>
+ setPlacement(
+ placeMenu(anchorTo.getBoundingClientRect(), {
+ width: window.innerWidth || 0,
+ height: window.innerHeight || 0,
+ }),
+ );
+ measure();
+ window.addEventListener("resize", measure);
+ window.addEventListener("scroll", measure, true);
+ return () => {
+ window.removeEventListener("resize", measure);
+ window.removeEventListener("scroll", measure, true);
+ };
+ }, [anchorTo]);
+
+ const detached = anchorTo != null && typeof document !== "undefined";
+ /*
+ * Undefined while the menu hangs inside its caller (the classes place it);
+ * the measured rectangle once it has been detached; and, for the single
+ * frame between mounting and measuring, hidden rather than absent — the
+ * entries keep their tab order and the autofocus below still lands, and
+ * nobody sees a menu in the top-left corner on its way to where it belongs.
+ */
+ const menuStyle: React.CSSProperties | undefined = !detached
+ ? undefined
+ : placement
+ ? {
+ position: "fixed",
+ left: placement.left,
+ top: placement.top,
+ width: MENU_WIDTH_PX,
+ maxHeight: placement.maxHeight,
+ }
+ : { visibility: "hidden" };
+ const menu = (
<>
{/* Click-anywhere-else to dismiss, without a global listener that would
outlive the surface that opened this. */}
@@ -83,13 +177,19 @@ export function AgentPickerMenu({
role="menu"
aria-label={ariaLabel}
data-testid={testId}
+ data-detached={detached ? "true" : undefined}
+ style={menuStyle}
className={cn(
// Scrolls rather than growing past the window: the list is every CLI
// the backend registered, and that is six entries on a machine with
// the usual set installed — more than fits under a button near the
// top of a laptop screen.
- "absolute z-50 max-h-[70vh] w-60 overflow-y-auto rounded-lg border border-border bg-card p-1 shadow-xl scrollbar-jarvis",
- className,
+ "z-50 max-h-[70vh] w-60 overflow-y-auto rounded-lg border border-border bg-card p-1 shadow-xl scrollbar-jarvis",
+ "animate-in fade-in-0 zoom-in-95 duration-150",
+ // The caller's anchoring classes describe a box INSIDE its own
+ // element ("right-2 top-full"), which is the very thing a detached
+ // menu is escaping. Its coordinates come from the measurement above.
+ detached ? "fixed" : cn("absolute", className),
)}
onMouseDown={(e) => e.stopPropagation()}
onKeyDown={(e) => {
@@ -134,4 +234,10 @@ export function AgentPickerMenu({
</div>
</>
);
+
+ // Rendered where it was measured against — the window — so the pane that
+ // opened it cannot clip it. Before the first measurement the menu is still
+ // mounted (its entries keep their focus order and are reachable by keyboard);
+ // it simply has no coordinates for one frame.
+ return detached ? createPortal(menu, document.body) : menu;
}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 1009356ad0..4502697fef 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -2929,29 +2929,57 @@ export function AgenticGrid({
!isMaximized &&
!layoutBusy &&
"transition-[left,top,width,height] duration-300 ease-out motion-reduce:transition-none",
- selectedTerminals.has(term.name) &&
- "ring-2 ring-primary ring-offset-2 ring-offset-background",
+ /*
+ * The three rings below are drawn WITHOUT an offset, and that
+ * is arithmetic rather than taste.
+ *
+ * Neighbouring panes sit `GRID_GAP_PX` apart, and each of them
+ * gives up half of that on a shared side (see `paneBoxStyle`).
+ * A pane therefore owns exactly `HALF_GAP_PX` — 2 px — outside
+ * its own box before it is standing on its neighbour. A ring
+ * with `ring-offset-2` needs FOUR: two for the offset band and
+ * two for the ring itself. Marking one pane consequently drew
+ * over the edge of the pane beside it, and drew the offset band
+ * in the app's opaque background — a hard grey stripe across
+ * glass that is otherwise showing the desktop through it.
+ *
+ * At `ring-2` and no offset the ring fills precisely the gap
+ * this pane owns and stops in the middle of it. Two selected
+ * neighbours meet; neither covers the other.
+ */
+ selectedTerminals.has(term.name) && "ring-2 ring-primary",
// Just arrived — see `justOpened`. Second to the selection ring
// deliberately: selection is a thing the user is DOING, and it
// must keep its own answer while panes come and go.
justOpened.has(term.name) &&
!selectedTerminals.has(term.name) &&
- "ring-2 ring-primary/70 ring-offset-2 ring-offset-background",
+ "ring-2 ring-primary/70",
// Just landed after a drag — same ring, same reasoning: the
// move happened, and the grid says WHERE.
justMoved?.name === term.name &&
!selectedTerminals.has(term.name) &&
- "ring-2 ring-primary/70 ring-offset-2 ring-offset-background",
+ "ring-2 ring-primary/70",
chatView || deckView
? onStage
- ? // On the deck the unfolded terminal sits ABOVE the room
- // it came from (`z-20` over the stage's own layer), so
- // the cards stay where they were and folding it away
- // puts the user back exactly where they left off.
- cn(
- "rounded-xl border border-border shadow-lg",
- deckView && "z-20",
- )
+ ? /*
+ * ONE edge per pane, in every view.
+ *
+ * This cell used to add `rounded-xl border border-border`
+ * of its own around a pane that already draws a rounded
+ * border in the TERMINAL's colours — two hairlines, at
+ * two different radii (12 px outside an 8 px corner), so
+ * every corner of the staged pane showed a sliver of app
+ * chrome curving around the pane's own. In grid view the
+ * same pane has a single edge, which is what made the
+ * switch to chat look like a different component rather
+ * than the same one enlarged.
+ *
+ * The lift stays: a staged pane genuinely IS raised above
+ * the rail beside it, and on the deck it sits above the
+ * room it came from (`z-20` over the stage's own layer),
+ * so folding it away puts the user back where they were.
+ */
+ cn("shadow-lg", deckView && "z-20")
: "hidden"
: maximized !== null && !isMaximized && "hidden",
)}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.offscreen.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.offscreen.test.tsx
index 930f9b1e2a..4142fe6ae9 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.offscreen.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.offscreen.test.tsx
@@ -83,6 +83,11 @@ vi.mock("@xterm/xterm", () => ({
vi.mock("@xterm/addon-fit", () => ({
FitAddon: class {
fit() {}
+ // The pane measures before it applies (see `sendResize`) — answer with the
+ // stand-in terminal's own 80x24 so every fit stays above the floors.
+ proposeDimensions() {
+ return { cols: 80, rows: 24 };
+ }
},
}));
vi.mock("@xterm/addon-web-links", () => ({ WebLinksAddon: class {} }));
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
index 31f2add5b1..39befc37e7 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
@@ -10,6 +10,8 @@ const terminalHarness = vi.hoisted(() => ({
size: { cols: 80, rows: 24 },
/** Every frame the pane hands its socket. Returns whether it went out. */
send: vi.fn<(payload: unknown) => boolean>(() => true),
+ /** Every explicit grid resize — how the pane pins itself below the floors. */
+ resize: vi.fn<(cols: number, rows: number) => void>(),
/** The live socket's handlers, so a test can play a reconnect. */
handlers: { current: null as Record<string, (...args: never[]) => void> | null },
/** Everything the pane types into the terminal on the user's behalf. */
@@ -136,7 +138,9 @@ vi.mock("@xterm/xterm", () => ({
terminalHarness.viewport.viewportY = line;
}
reset() {}
- resize() {}
+ resize(cols: number, rows: number) {
+ terminalHarness.resize(cols, rows);
+ }
dispose() {}
clearTextureAtlas() {}
},
@@ -147,6 +151,12 @@ vi.mock("@xterm/addon-fit", () => ({
fit() {
terminalHarness.fit();
}
+ // The pane measures before it applies (see `sendResize`), so the double
+ // answers with whatever size the test has staged — the same value fit()
+ // would land on.
+ proposeDimensions() {
+ return { ...terminalHarness.size };
+ }
},
}));
vi.mock("@xterm/addon-web-links", () => ({ WebLinksAddon: class {} }));
@@ -175,6 +185,7 @@ vi.mock("@/lib/editActions", () => ({ attachTerminalBridge: () => undefined }));
vi.mock("@/lib/agenticIdeApi", () => ({ attachToTerminal: vi.fn() }));
import { AgenticTerminal, REBUILD_QUIET_MS } from "./AgenticTerminal";
+import { PANE_CHROME } from "./terminalThemes";
/**
* Past the quiet window a rebuilt pane waits out, plus the reveal frame behind
@@ -937,6 +948,65 @@ describe("pane header actions", () => {
expect(screen.getByTestId("pane-close-Dana")).toBeTruthy();
});
+ it("fills the workspace on a double-click of the title bar", () => {
+ const onToggleMaximize = vi.fn();
+ render(
+ <AgenticTerminal
+ name="Dana"
+ displayName="Claude Code"
+ appearance="dark"
+ fontSize={13}
+ onToggleMaximize={onToggleMaximize}
+ />,
+ );
+
+ fireEvent.doubleClick(screen.getByTestId("pane-header-Dana"));
+
+ expect(onToggleMaximize).toHaveBeenCalledTimes(1);
+ });
+
+ it("renames instead of maximizing when the call-sign is the target", () => {
+ const onToggleMaximize = vi.fn();
+ render(
+ <AgenticTerminal
+ name="Dana"
+ displayName="Claude Code"
+ appearance="dark"
+ fontSize={13}
+ onToggleMaximize={onToggleMaximize}
+ onRename={async () => true}
+ />,
+ );
+
+ // The call-sign is the more specific target and stops the event, so the
+ // bar underneath never sees it — one gesture, one meaning.
+ fireEvent.doubleClick(screen.getByText("Dana"));
+
+ expect(screen.getByTestId("pane-rename-input-Dana")).toBeTruthy();
+ expect(onToggleMaximize).not.toHaveBeenCalled();
+ });
+
+ it("leaves a double-click on one of its own buttons to that button", () => {
+ const onToggleMaximize = vi.fn();
+ const onClose = vi.fn();
+ render(
+ <AgenticTerminal
+ name="Dana"
+ displayName="Claude Code"
+ appearance="dark"
+ fontSize={13}
+ onToggleMaximize={onToggleMaximize}
+ onClose={onClose}
+ />,
+ );
+
+ // Two clicks on Close are two closes, never a maximize — the same guard
+ // the drag grip uses, for the same reason.
+ fireEvent.doubleClick(screen.getByTestId("pane-close-Dana"));
+
+ expect(onToggleMaximize).not.toHaveBeenCalled();
+ });
+
it("keeps every action visible on the focused pane", () => {
render(
<AgenticTerminal
@@ -1089,6 +1159,7 @@ describe("pane refit", () => {
terminalHarness.fit.mockClear();
terminalHarness.send.mockClear();
terminalHarness.send.mockImplementation(() => true);
+ terminalHarness.resize.mockClear();
terminalHarness.handlers.current = null;
terminalHarness.size = { cols: 80, rows: 24 };
vi.spyOn(document, "hasFocus").mockReturnValue(true);
@@ -1217,6 +1288,29 @@ describe("pane refit", () => {
});
});
+ it("keeps the local grid at the agent's geometry while below the floors", () => {
+ // Refusing the size is only half of the contract (test above). The other
+ // half is the LOCAL grid: fit()ing xterm to a 17-column tile while the
+ // agent keeps laying its lines out for 80 re-wraps every one of them at
+ // the narrower measure, and the TUI's cursor moves then land on rows that
+ // no longer hold what they held when it drew them. A five-pane grid came
+ // back as panes full of shredded one-word fragments (reported
+ // 2026-08-10). So below the floors nothing is fit at all — the grid is
+ // pinned back to the geometry the agent was last told, and the tile's
+ // overflow-hidden container clips the rest.
+ const view = render(pane(false));
+ settle();
+ terminalHarness.fit.mockClear();
+ terminalHarness.resize.mockClear();
+
+ terminalHarness.size = { cols: 17, rows: 6 };
+ view.rerender(pane(true));
+ settle();
+
+ expect(terminalHarness.fit).not.toHaveBeenCalled();
+ expect(terminalHarness.resize).toHaveBeenCalledWith(80, 24);
+ });
+
it("tells a fresh socket the pane's size whatever the last one heard", () => {
render(pane(false));
settle();
@@ -1571,3 +1665,195 @@ describe("terminal text size across a rebuild", () => {
expect(newest().options.theme).not.toEqual(openedWith);
});
});
+
+/**
+ * What a pane says about its own state, and where it says it.
+ *
+ * Both halves used to live somewhere that lost them. The reason a pane died was
+ * written INTO the terminal, where the next thing drawn scrolls it away and the
+ * one-line-per-kind-of-trouble guard means it is never written again; the way
+ * out was a button in the hover-only action cluster. The badge and the notice
+ * below are the durable versions of each.
+ */
+describe("pane status", () => {
+ beforeEach(() => {
+ globalThis.ResizeObserver = ResizeObserverHarness;
+ terminalHarness.handlers.current = null;
+ terminalHarness.write.mockClear();
+ });
+
+ afterEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ const pane = (props: Record<string, unknown> = {}) => (
+ <AgenticTerminal
+ name="Dana"
+ displayName="Claude Code"
+ appearance="dark"
+ fontSize={13}
+ {...props}
+ />
+ );
+
+ it("opens carrying its connecting state, with no notice to answer yet", () => {
+ render(pane());
+
+ expect(screen.getByTestId("pane-status-Dana").dataset.status).toBe(
+ "connecting",
+ );
+ expect(screen.getByTestId("pane-activity").dataset.icon).toBe("spinner");
+ expect(screen.queryByTestId("pane-notice-Dana")).toBeNull();
+ });
+
+ /**
+ * `live` is a property of the PIPE and true for nearly every pane nearly all
+ * the time, so a standing dot on twelve headers marks nothing. It stays in
+ * the DOM and fades in with the header's other controls.
+ */
+ it("keeps a healthy pane's badge quiet until the header is hovered", () => {
+ render(pane());
+
+ act(() => {
+ terminalHarness.handlers.current?.onReady?.(
+ { resumed: false, reattached: false, lastPrompt: null } as never,
+ );
+ });
+
+ const badge = screen.getByTestId("pane-status-Dana");
+ expect(badge.dataset.status).toBe("live");
+ expect(badge.className).toContain("opacity-0");
+ expect(badge.className).toContain("group-hover/header:opacity-60");
+ expect(screen.queryByTestId("pane-notice-Dana")).toBeNull();
+ });
+
+ it("says what happened when the agent exits, and offers the way back", () => {
+ const onRestart = vi.fn();
+ render(pane({ onRestart }));
+
+ act(() => {
+ terminalHarness.handlers.current?.onExit?.(0 as never);
+ });
+
+ expect(screen.getByTestId("pane-status-Dana").dataset.status).toBe("exited");
+ const notice = screen.getByTestId("pane-notice-Dana");
+ expect(notice.dataset.tone).toBe("warning");
+ // The exit reason is a CLAUSE ("stopped"), so the notice puts the agent in
+ // front of it rather than showing a strip that reads as one bare word.
+ expect(notice.textContent).toContain("Claude Code stopped");
+
+ fireEvent.click(screen.getByTestId("pane-restart-Dana"));
+ expect(onRestart).toHaveBeenCalledTimes(1);
+ });
+
+ it("marks an unreachable pane as an error rather than a warning", () => {
+ render(pane({ onRestart: () => undefined }));
+
+ act(() => {
+ terminalHarness.handlers.current?.onTrouble?.(
+ "This pane could not be reached." as never,
+ false as never,
+ );
+ });
+
+ expect(screen.getByTestId("pane-status-Dana").dataset.status).toBe("error");
+ const notice = screen.getByTestId("pane-notice-Dana");
+ expect(notice.dataset.tone).toBe("error");
+ expect(notice.textContent).toContain("could not be reached");
+ });
+
+ /*
+ * The edge, read the way the browser reads it.
+ *
+ * jsdom re-serialises a colour the moment it is assigned, and it does not
+ * agree with the source spelling about spaces — so the expected value is put
+ * through the SAME assignment rather than compared as a string. Otherwise
+ * this test is about `rgba(0,0,0,0.05)` versus `rgba(0, 0, 0, 0.05)`, which
+ * is a fact about jsdom and not about the pane.
+ */
+ const asBorderColor = (value: string) => {
+ const probe = document.createElement("div");
+ probe.style.borderColor = value;
+ return probe.style.borderColor;
+ };
+
+ /**
+ * The edge is what a reader can SWEEP — the badge and the notice both have to
+ * be landed on first. A pane whose agent is gone recedes; one that failed
+ * carries the terminal's own red.
+ */
+ it("carries the pane's lifecycle in its edge", () => {
+ render(pane({ onRestart: () => undefined }));
+ const frame = screen.getByTestId("agentic-pane-Dana");
+ const resting = frame.style.borderColor;
+
+ expect(resting).toBe(asBorderColor(PANE_CHROME.dark.edge.connecting));
+
+ act(() => {
+ terminalHarness.handlers.current?.onExit?.(0 as never);
+ });
+ expect(frame.style.borderColor).toBe(
+ asBorderColor(PANE_CHROME.dark.edge.exited),
+ );
+ // Dimmer than resting rather than another colour — a finished terminal is
+ // not a problem, so it steps back instead of announcing itself.
+ expect(frame.style.borderColor).not.toBe(resting);
+
+ act(() => {
+ terminalHarness.handlers.current?.onTrouble?.(
+ "This pane could not be reached." as never,
+ false as never,
+ );
+ });
+ expect(frame.style.borderColor).toBe(
+ asBorderColor(PANE_CHROME.dark.edge.error),
+ );
+ });
+
+ /**
+ * The three accent states paint the edge through a CLASS, and an inline
+ * colour beats every class. So this is not a style preference — leaving the
+ * property set is what stopped a dragged pane, and one that had just been
+ * handed a prompt, from showing anything but the shadow half of its own
+ * highlight.
+ */
+ it("lets the accent states own the edge outright", () => {
+ const view = render(pane({ focused: true }));
+ const frame = screen.getByTestId("agentic-pane-Dana");
+
+ expect(frame.style.borderColor).toBe("");
+ expect(frame.className).toContain("border-primary/60");
+
+ view.rerender(pane({ focused: false }));
+ expect(frame.style.borderColor).not.toBe("");
+
+ // A prompt just landed: two seconds of ring, edge included.
+ act(() => {
+ terminalHarness.handlers.current?.onPrompt?.(
+ { text: "Run the tests", at: 2, chars: 13 } as never,
+ );
+ });
+ expect(frame.style.borderColor).toBe("");
+ });
+
+ /**
+ * A scheduled retry is not a dead pane. Calling it an error there is what
+ * painted a whole grid red over a backend that was merely restarting — the
+ * notice must stand down with it.
+ */
+ it("takes the notice away again while the socket is only retrying", () => {
+ render(pane());
+
+ act(() => {
+ terminalHarness.handlers.current?.onTrouble?.(
+ "Reconnecting…" as never,
+ true as never,
+ );
+ });
+
+ expect(screen.getByTestId("pane-status-Dana").dataset.status).toBe(
+ "connecting",
+ );
+ expect(screen.queryByTestId("pane-notice-Dana")).toBeNull();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
index 61b9595d85..35dd3fc17d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
@@ -95,6 +95,7 @@ import {
type SplitAgentChoice,
} from "./AgentPicker";
import { describeExit, explainExit } from "./paneExit";
+import { PaneActivityPill } from "./PaneActivityPill";
import { PaneRecap } from "./PaneRecap";
import { attachToTerminal } from "@/lib/agenticIdeApi";
import type { RecapReason, RecapSource } from "@/lib/agenticIdeApi";
@@ -249,6 +250,14 @@ const MAX_TERMINAL_NAME = 40;
* which costs a clipped line in a narrow tile and keeps the agent alive. A
* clamp would instead hand the agent a size no window is actually showing.
*
+ * "Shows as much of it as fits" is a promise about the LOCAL grid as well.
+ * Refusing the size while still fit()ing xterm to the narrow tile left the
+ * two halves disagreeing — the agent laying lines out for 80+ columns, the
+ * viewer re-wrapping them at 25 — and every pane under the floors came back
+ * as shredded one-word fragments (reported 2026-08-10). So below the floors
+ * the grid is PINNED to the geometry the agent draws for (see `agentSize`),
+ * and the tile's overflow-hidden container does the clipping.
+ *
* Both the resize path and the connect-time handshake below refuse anything
* under these floors; the backend enforces the same ones
* (`jarvis/agentic_ide/session.py`), so a stale or older client cannot do the
@@ -478,6 +487,17 @@ export function AgenticTerminal({
// Mirrored into state purely so the header can show/hide the restart button;
// it transitions a handful of times per pane, never per output chunk.
const [visibleStatus, setVisibleStatus] = useState<PaneStatus>("connecting");
+ /*
+ * What the socket said ABOUT that status, in the user's words.
+ *
+ * Kept here as well as handed to `onStatus` because the two readers need it
+ * at different times. The grid shows it once, in a tooltip; the pane has to
+ * keep saying it — an exit reason written into the terminal scrolls away the
+ * moment anything else is drawn, and the trouble line is written at most once
+ * per KIND of trouble (see `troubleShown`), so a user who looked away has no
+ * way back to it at all. The notice below is that way back.
+ */
+ const [statusDetail, setStatusDetail] = useState<string>("");
/*
* Has this pane's agent drawn anything yet?
*
@@ -766,7 +786,20 @@ export function AgenticTerminal({
input: (data) => term.input(data),
});
try {
- fit.fit();
+ // The same floors the resize path holds (see MIN_REAL_COLS). A pane
+ // mounted straight into a narrow tile must keep the 80x24 the terminal
+ // was built with — the geometry the connect handshake announces — rather
+ // than fit itself below what its agent is about to draw for.
+ const proposed = fit.proposeDimensions();
+ if (
+ proposed &&
+ Number.isFinite(proposed.cols) &&
+ Number.isFinite(proposed.rows) &&
+ proposed.cols >= MIN_REAL_COLS &&
+ proposed.rows >= MIN_REAL_ROWS
+ ) {
+ fit.fit();
+ }
} catch {
/* not measured yet — the ResizeObserver below will fit */
}
@@ -774,6 +807,7 @@ export function AgenticTerminal({
const report = (status: PaneStatus, detail?: string) => {
statusRef.current = status;
setVisibleStatus(status);
+ setStatusDetail(detail ?? "");
onStatusRef.current?.(status, detail);
};
@@ -1155,6 +1189,25 @@ export function AgenticTerminal({
*/
let sentSize: { cols: number; rows: number } | null = null;
+ /*
+ * The geometry the agent is DRAWING for, as best this pane knows: the
+ * connect-time handshake until a resize is delivered, then that resize.
+ *
+ * Needed because refusing to announce a size (below) is only half of the
+ * floors' contract. The PTY keeps its working geometry — so the local
+ * grid has to keep it too. Fitting the viewer below what the agent lays
+ * its lines out for re-wraps every one of them at the narrower measure,
+ * and the TUI's cursor moves then land on rows that no longer hold what
+ * they held when it drew them: a five-pane grid came back as panes full
+ * of shredded one-word fragments (reported 2026-08-10). Pinned to this
+ * geometry instead, a narrow tile shows the top-left of an honest frame
+ * and clips the rest — which is what the floors' comment promised.
+ */
+ let agentSize = {
+ cols: term.cols >= MIN_REAL_COLS ? term.cols : 80,
+ rows: term.rows >= MIN_REAL_ROWS ? term.rows : 24,
+ };
+
const viewerMayOwn = () =>
activeRef.current &&
!documentHidden() &&
@@ -1168,6 +1221,36 @@ export function AgenticTerminal({
// wrecks the agent's full-screen drawing. Skip while not measurable; the
// ResizeObserver fires again when the pane comes back.
if (container.clientWidth < 8 || container.clientHeight < 8) return;
+ // Measured WITHOUT being applied yet: a size the floors refuse must not
+ // shrink the local grid either (see agentSize above).
+ let proposed: { cols: number; rows: number } | undefined;
+ try {
+ proposed = fit.proposeDimensions();
+ } catch {
+ return;
+ }
+ if (
+ !proposed ||
+ !Number.isFinite(proposed.cols) ||
+ !Number.isFinite(proposed.rows)
+ ) {
+ return;
+ }
+ if (proposed.cols < MIN_REAL_COLS || proposed.rows < MIN_REAL_ROWS) {
+ // Too narrow to hand to the agent — keep drawing at the geometry the
+ // agent still formats for; the tile clips what it cannot show.
+ if (term.cols !== agentSize.cols || term.rows !== agentSize.rows) {
+ try {
+ term.resize(agentSize.cols, agentSize.rows);
+ } catch {
+ /* mid-teardown — nothing left to pin */
+ }
+ }
+ // Still the un-park moment: a pane squeezed under the floors is being
+ // looked at all the same.
+ revealIfOnScreen();
+ return;
+ }
try {
fit.fit();
} catch {
@@ -1195,7 +1278,10 @@ export function AgenticTerminal({
) {
return;
}
- if (socket?.send({ t: claimOwner ? "claim" : "r", ...size })) sentSize = size;
+ if (socket?.send({ t: claimOwner ? "claim" : "r", ...size })) {
+ sentSize = size;
+ agentSize = size;
+ }
};
resizeRef.current = sendResize;
const claimResize = () => {
@@ -1213,9 +1299,12 @@ export function AgenticTerminal({
// `sendResize` refuses to SEND but which used to travel here as the
// handshake geometry, spawning (or resizing) the PTY one column wide.
// A size under the plausibility floor is treated as "not measured yet";
- // the real one follows from `onOpen`'s fit as soon as the cell settles.
- cols: term.cols >= MIN_REAL_COLS ? term.cols : 80,
- rows: term.rows >= MIN_REAL_ROWS ? term.rows : 24,
+ // the real one follows from `onOpen`'s fit as soon as the cell
+ // settles. `agentSize` captured exactly that at its declaration, and
+ // using it HERE is what keeps the pinned local grid and the spawned
+ // PTY agreeing about the pane's geometry.
+ cols: agentSize.cols,
+ rows: agentSize.rows,
appearance: appearanceRef.current,
claimOwner: viewerMayOwn(),
},
@@ -1300,7 +1389,8 @@ export function AgenticTerminal({
if (
activeRef.current &&
focusedRef.current &&
- (document.activeElement === null || document.activeElement === document.body)
+ (document.activeElement === null ||
+ document.activeElement === document.body)
) {
term.focus();
}
@@ -1755,8 +1845,17 @@ export function AgenticTerminal({
// only standing accent. The old per-pane drop shadows made a grid of
// twelve read as twelve floating cards — a tiling terminal is a wall,
// and a wall needs edges, not elevation.
- "relative flex h-full w-full flex-col overflow-hidden rounded-lg border backdrop-blur-[4px] transition-shadow",
- focused && "border-primary/60 shadow-[0_0_0_1px_hsl(var(--primary)/0.3)]",
+ //
+ // The border colour is part of the transition, not just the shadow.
+ // Every state below changes BOTH, and animating only one made the
+ // change arrive twice: the edge snapped to yellow on the frame the
+ // click landed, and the ring around it faded in over the next 150 ms.
+ // On a grid where the focused pane is the one standing accent, that
+ // read as a flicker rather than as a pane taking focus.
+ "relative flex h-full w-full flex-col overflow-hidden rounded-lg border backdrop-blur-[4px]",
+ "transition-[box-shadow,border-color,opacity] duration-150 ease-out motion-reduce:transition-none",
+ focused &&
+ "border-primary/60 shadow-[0_0_0_1px_hsl(var(--primary)/0.3)]",
dragging && "border-primary shadow-[0_0_0_2px_hsl(var(--primary)/0.5)]",
// A prompt just landed here. Two seconds of ring, for the one job the
// receipt below cannot do: telling the user WHICH pane out of eight to
@@ -1771,14 +1870,32 @@ export function AgenticTerminal({
)}
style={{
background: chrome.shell,
- borderColor: focused ? undefined : chrome.border,
+ /*
+ * The edge, and WHO is allowed to paint it.
+ *
+ * An inline colour beats every class, so this property decides whether
+ * the three accent states above are drawn at all. It used to yield to
+ * `focused` alone — which meant a pane being dragged, or one that had
+ * just been handed a prompt, kept its plain grey edge and showed only
+ * the shadow half of its own highlight. All three yield now.
+ *
+ * What is left is the resting pane, and its edge is where the pane's
+ * lifecycle can be read from across the workspace rather than by
+ * landing on it: dimmer once the agent has exited, the terminal's own
+ * red when it failed, unchanged while it is connecting or live. See
+ * `PANE_CHROME.edge` for why only those two states are marked.
+ */
+ borderColor:
+ focused || dragging || justDelivered
+ ? undefined
+ : chrome.edge[visibleStatus],
}}
data-testid={`agentic-pane-${name}`}
>
<PaneHeader
workspaceId={workspaceId}
- dead={visibleStatus === "exited" || visibleStatus === "error"}
- onRestart={onRestart}
+ status={visibleStatus}
+ statusDetail={statusDetail}
onArrangeStart={onArrangeStart}
arranging={arranging}
name={name}
@@ -1800,6 +1917,19 @@ export function AgenticTerminal({
splitDisabled={splitDisabled}
onOpenConversation={() => setHistoryOpen(true)}
/>
+ {/*
+ What went wrong, kept on screen for as long as it is true — and the one
+ way out of it. See PaneStatusNotice for why this is a row of its own
+ rather than a second button in the header.
+ */}
+ <PaneStatusNotice
+ name={name}
+ displayName={displayName}
+ status={visibleStatus}
+ detail={statusDetail}
+ light={appearance === "light"}
+ onRestart={onRestart}
+ />
{/*
Keep the visual inset OUTSIDE xterm's measured host. FitAddon reads the
host's border-box but does not subtract padding on that host, so putting
@@ -1921,8 +2051,8 @@ function PaneHeader({
onRename,
onClose,
splitDisabled,
- dead,
- onRestart,
+ status,
+ statusDetail,
onArrangeStart,
arranging = false,
onOpenConversation,
@@ -1945,9 +2075,10 @@ function PaneHeader({
onRename?: (name: string) => Promise<boolean>;
onClose?: () => void;
splitDisabled: boolean;
- /** The agent in this pane has exited or failed — offer to start it again. */
- dead: boolean;
- onRestart?: () => void;
+ /** The socket's own view of this pane — the badge beside the call-sign. */
+ status: PaneStatus;
+ /** Whatever the socket said about that status, read in the badge's tooltip. */
+ statusDetail?: string;
/** Press on the header picks the pane up; absent leaves it undraggable. */
onArrangeStart?: (event: React.PointerEvent) => void;
arranging?: boolean;
@@ -1956,6 +2087,10 @@ function PaneHeader({
}) {
const t = useT();
const light = appearance === "light";
+ // What the split menu hangs off. The pane clips everything inside it, so the
+ // menu is measured against this bar and drawn in front of the window — see
+ // `anchorTo` in ./AgentPicker.
+ const headerRef = useRef<HTMLElement | null>(null);
// Which split button opened the CLI picker, if any.
const [picking, setPicking] = useState<SplitDirection | null>(null);
// The call-sign editor: null while the badge is just a badge, otherwise the
@@ -1992,6 +2127,7 @@ function PaneHeader({
return (
<header
+ ref={headerRef}
data-testid={`pane-header-${name}`}
// The grip. It is the header itself rather than a separate handle icon,
// because that is where the gesture is already expected — every window on
@@ -2011,17 +2147,56 @@ function PaneHeader({
}
: undefined
}
+ /*
+ * Double-click the title bar to fill the workspace, and again to go back.
+ *
+ * The same gesture every window manager on every desktop already binds,
+ * and the pane header is already the title bar — it is dragged like one.
+ * The button beside it stays, because a gesture nothing on screen
+ * advertises cannot be the only way in (the same rule the rename pencil
+ * follows); this is the way people who never look for a button get there.
+ *
+ * Safe beside the drag above: `paneArrange` only lifts a pane once the
+ * pointer has travelled `DRAG_THRESHOLD_PX`, so two clicks in one place
+ * are two clicks and never a move. The control check is the same one — a
+ * double-click on Close is a close, twice, not a maximize — and the
+ * call-sign stops the event itself, because a double-click there already
+ * means rename.
+ */
+ onDoubleClick={
+ onToggleMaximize
+ ? (event) => {
+ const target = event.target as HTMLElement | null;
+ if (target?.closest("button, a, input, [role='menuitem']"))
+ return;
+ onToggleMaximize();
+ }
+ : undefined
+ }
title={
onArrangeStart
- ? `Drag ${name} by this bar to move it — drop it on another terminal to swap, or near an edge to place it there`
- : undefined
+ ? `Drag ${name} by this bar to move it — drop it on another terminal to swap, or near an edge to place it there. Double-click to fill the workspace.`
+ : onToggleMaximize
+ ? `Double-click to make ${name} fill the workspace`
+ : undefined
}
className={cn(
// No tinted strip of its own: the header shares the terminal's ground
// and the border underneath is enough to say where the output begins.
// Twelve tinted bands across the workspace were twelve horizontal
// stripes the eye had to skip on the way to the text that matters.
- "group/header relative flex items-center justify-between gap-1.5 border-b px-2 py-0.5",
+ //
+ // `min-h-7` rather than height by content: the bar holds a 24 px action
+ // cluster, a 20 px rename field and a 16 px badge, and each of them
+ // comes and goes on its own schedule (hover, rename, a status change).
+ // Sized by whatever is in it, the header grew and shrank by a couple of
+ // pixels under the pointer — and every one of those pixels is a row the
+ // terminal underneath has to be refitted for. A floor holds it still.
+ //
+ // `overflow-hidden` is the other half of that promise: the left group
+ // truncates and the action cluster keeps its width, so a narrow pane
+ // ends in an ellipsis rather than pushing its own buttons off the edge.
+ "group/header relative flex min-h-7 items-center justify-between gap-1.5 overflow-hidden border-b px-2 py-0.5",
onArrangeStart && (arranging ? "cursor-grabbing" : "cursor-grab"),
)}
style={{
@@ -2040,9 +2215,15 @@ function PaneHeader({
* A form rather than a bare input so Enter saves the way it does in
* every other name field in the app, and Escape closes it — the two
* keys somebody renaming a pane will reach for without looking.
+ *
+ * It SHRINKS. A fixed 128 px field plus its two buttons is wider than
+ * a pane in a twelve-pane wall has to spare, and beside an action
+ * cluster that keeps its own width the surplus went somewhere: the
+ * save and cancel buttons were pushed under the cluster, so the one
+ * control the user needed next was the one they could not reach.
*/
<form
- className="flex shrink-0 items-center gap-1"
+ className="flex min-w-0 flex-1 items-center gap-1"
onSubmit={(event) => {
event.preventDefault();
void commitRename();
@@ -2064,12 +2245,14 @@ function PaneHeader({
event.stopPropagation();
}}
className={cn(
- "w-32 rounded-md px-2 py-0.5 font-display text-[13px] font-semibold tracking-tight outline-none",
- "border border-primary/50 focus:border-primary disabled:opacity-60",
+ "w-full min-w-0 max-w-[9rem] rounded-md px-2 py-0.5 font-display text-[13px] font-semibold tracking-tight outline-none",
+ "border border-primary/50 transition-colors focus:border-primary disabled:opacity-60",
)}
style={{
color: light ? "#2b2b33" : "#e8e8ec",
- background: light ? "rgba(0,0,0,0.04)" : "rgba(255,255,255,0.06)",
+ background: light
+ ? "rgba(0,0,0,0.04)"
+ : "rgba(255,255,255,0.06)",
}}
/>
<button
@@ -2077,7 +2260,11 @@ function PaneHeader({
disabled={saving || !draft.trim()}
aria-label={`Save name for ${name}`}
data-testid={`pane-rename-save-${name}`}
- className="flex h-5 w-5 shrink-0 items-center justify-center rounded text-primary hover:bg-primary/15 disabled:opacity-40"
+ className={cn(
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded text-primary",
+ "transition-colors duration-150 hover:bg-primary/15 disabled:opacity-40",
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70",
+ )}
>
{saving ? (
<Loader2 className="h-3 w-3 animate-spin" />
@@ -2090,7 +2277,11 @@ function PaneHeader({
disabled={saving}
aria-label={`Cancel renaming ${name}`}
onClick={() => setDraft(null)}
- className="flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted"
+ className={cn(
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground",
+ "transition-colors duration-150 hover:bg-muted hover:text-foreground",
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70",
+ )}
>
<X className="h-3 w-3" />
</button>
@@ -2102,7 +2293,18 @@ function PaneHeader({
// already uses for "rename this", so it is offered here too — but
// it is never the only way in, because nothing on screen advertises
// it. The pencil beside it is what makes the feature findable.
- onDoubleClick={onRename ? () => setDraft(name) : undefined}
+ //
+ // The event stops here: the bar underneath reads a double-click as
+ // "fill the workspace", and one gesture must not do two things.
+ // The call-sign is the more specific target, so it wins.
+ onDoubleClick={
+ onRename
+ ? (event) => {
+ event.stopPropagation();
+ setDraft(name);
+ }
+ : undefined
+ }
title={onRename ? `${name} — double-click to rename` : undefined}
// The focused pane's call-sign is the workspace's one standing
// accent; every other name is plain text. A filled badge on all
@@ -2112,7 +2314,9 @@ function PaneHeader({
"shrink-0 rounded-md px-1.5 py-0.5 font-display text-[13px] font-semibold tracking-tight",
focused ? "bg-primary/20 text-primary" : "",
)}
- style={focused ? undefined : { color: light ? "#2b2b33" : "#e8e8ec" }}
+ style={
+ focused ? undefined : { color: light ? "#2b2b33" : "#e8e8ec" }
+ }
>
{name}
</span>
@@ -2137,6 +2341,31 @@ function PaneHeader({
)}
</>
)}
+ {/*
+ The pane's own state, in the colour language the rest of the section
+ already speaks (see ./PaneActivityPill, which owns the vocabulary and
+ is the same badge the chat rail shows).
+
+ Only three of the four states are news. `live` is a property of the
+ PIPE — true for nearly every pane nearly all the time — so a standing
+ dot on all twelve headers would mark nothing, which is exactly the
+ badge the activity pill was written to replace. It is kept in the DOM
+ and fades in with the rest of the header's controls, so the answer is
+ one hover away for anyone who wants it, while `connecting`, `exited`
+ and `error` announce themselves whether or not anyone is pointing.
+ */}
+ <span
+ data-testid={`pane-status-${name}`}
+ data-status={status}
+ className={cn(
+ "flex shrink-0 items-center transition-opacity duration-200",
+ status === "live"
+ ? "opacity-0 group-hover/header:opacity-60"
+ : "opacity-100",
+ )}
+ >
+ <PaneActivityPill status={status} detail={statusDetail} />
+ </span>
<PaneRecap
name={name}
displayName={displayName}
@@ -2158,7 +2387,10 @@ function PaneHeader({
which pane bills which plan is the whole point. */}
{accountLabel && (
<span
- className="max-w-[8rem] shrink-0 truncate rounded-full px-1.5 text-[10px] tracking-wide"
+ // Allowed to give way (`min-w-0`, no `shrink-0`): which seat a pane
+ // bills is worth a badge, but never worth pushing the call-sign or
+ // the pane's own state off a narrow header to say it.
+ className="min-w-0 max-w-[8rem] truncate rounded-full px-1.5 text-[10px] tracking-wide"
style={{
color: light ? "#6b6b73" : "#9a9aa5",
backgroundColor: light ? "#00000010" : "#ffffff12",
@@ -2171,27 +2403,6 @@ function PaneHeader({
)}
</div>
- {/* Restart is an EVENT, not furniture — a dead agent must announce
- itself whether or not anyone hovers, so it sits outside the cluster
- that hides. */}
- {dead && (
- <button
- type="button"
- aria-label={`Restart ${name}`}
- title={`Start a fresh ${displayName} in ${name}`}
- data-testid={`pane-restart-${name}`}
- onClick={(e) => {
- e.stopPropagation();
- onRestart?.();
- }}
- onMouseDown={(e) => e.stopPropagation()}
- className="mr-1 flex shrink-0 items-center gap-1 rounded bg-primary/20 px-2 py-0.5 text-[11px] font-medium text-primary transition-colors hover:bg-primary/30"
- >
- <RotateCcw className="h-3 w-3" />
- Restart
- </button>
- )}
-
{/* Pane actions appear where the eye already is: on the pane under the
pointer, on the focused pane, and while one of their menus is open.
Five buttons on every header of a twelve-pane wall were sixty
@@ -2277,6 +2488,12 @@ function PaneHeader({
testId={`pane-split-menu-${picking}-${name}`}
itemTestId={(agent) => `pane-split-${picking}-${name}-${agent}`}
className="right-2 top-full mt-1"
+ // Measured against this bar and drawn in front of the window. A pane
+ // is `overflow-hidden` by necessity, so a menu positioned inside one
+ // is cut off at its edge — in a twelve-pane wall that left a sliver
+ // of the first entry and nothing to pick from. It also flips above
+ // the header when the pane sits at the bottom of the screen.
+ anchorTo={headerRef.current}
onDismiss={() => setPicking(null)}
onPick={(agent) => {
setPicking(null);
@@ -2325,20 +2542,159 @@ function PaneAction({
}}
onMouseDown={(e) => e.stopPropagation()}
className={cn(
- "flex h-6 w-6 items-center justify-center rounded transition-colors disabled:cursor-not-allowed disabled:opacity-30",
+ "flex h-6 w-6 shrink-0 items-center justify-center rounded",
+ // Colour AND background, over the same 150 ms: hovering used to change
+ // only the ground behind the glyph, which on a translucent pane is a
+ // very small amount of contrast to confirm the pointer is on target.
+ "transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-30",
+ // Reachable by keyboard and visibly so. The cluster is revealed by
+ // `focus-within`, which is worth nothing if the focused button then
+ // looks identical to its four neighbours.
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70",
+ // The resting colour is a CLASS rather than an inline style, and that is
+ // load-bearing rather than tidiness: an inline `color` beats every
+ // class, so the hover colour below would simply never take effect.
+ light ? "text-[#55555e]" : "text-[#a8a8b2]",
danger
? "hover:bg-destructive/20 hover:text-destructive"
: light
- ? "hover:bg-scrim/10"
- : "hover:bg-sheen/10",
+ ? "hover:bg-scrim/10 hover:text-[#2b2b33]"
+ : "hover:bg-sheen/10 hover:text-[#e8e8ec]",
)}
- style={{ color: light ? "#55555e" : "#a8a8b2" }}
>
{children}
</button>
);
}
+/**
+ * The two tones a pane notice comes in, resolved against the PANE's own ground.
+ *
+ * Not the app's `--destructive` / amber tokens, and that is the whole reason
+ * this table exists rather than a call to the section's shared `Notice`: the
+ * terminal appearance is a separate setting from the app theme (plenty of
+ * people run dark panes in a light app, and the reverse — see the appearance
+ * note in ./AgenticGrid). A token picked for the app would land on the wrong
+ * ground in exactly those two configurations, which is where a warning is least
+ * affordable. The hues are the ones the pane's own palette already uses for
+ * yellow and red (./terminalThemes), so a notice reads as part of the terminal
+ * rather than as the app leaning in over it.
+ */
+const NOTICE_TONE: Record<
+ "warning" | "error",
+ Record<TerminalAppearance, { border: string; text: string }>
+> = {
+ warning: {
+ light: { border: "rgba(154,103,0,0.65)", text: "#8a5a00" },
+ dark: { border: "rgba(255,214,10,0.55)", text: "#ffd479" },
+ },
+ error: {
+ light: { border: "rgba(192,57,43,0.7)", text: "#b3261e" },
+ dark: { border: "rgba(255,107,94,0.6)", text: "#ff8b80" },
+ },
+};
+
+/**
+ * What went wrong in this pane, and the one way out of it.
+ *
+ * ## Why a row of its own rather than a badge
+ *
+ * Both halves of this used to be somewhere else, and neither survived being
+ * there. The reason was written INTO the terminal — an exit banner, or one
+ * trouble line per kind of trouble (see `troubleShown`) — where the next thing
+ * the pane draws scrolls it away and nothing brings it back; a user returning
+ * to a dead pane found a still screen and no sentence explaining it. The way
+ * out was a small button in the header, in the cluster that hides until the
+ * pane is hovered or focused, competing for width with five others.
+ *
+ * A dead pane can afford the height. Its terminal is not being drawn into any
+ * more, so the ~24 px this costs comes out of a static screen — and it buys the
+ * two things that pane owes the user: what happened, and what to press.
+ *
+ * ## Why the live states show nothing
+ *
+ * `connecting` and `live` are answered better elsewhere and answered already:
+ * the starting overlay covers a pane that has not painted yet, and the badge in
+ * the header carries the state for anyone who looks. A standing strip for them
+ * would take a row off every healthy pane in the workspace to say "fine".
+ */
+function PaneStatusNotice({
+ name,
+ displayName,
+ status,
+ detail,
+ light,
+ onRestart,
+}: {
+ name: string;
+ displayName: string;
+ status: PaneStatus;
+ detail?: string;
+ light: boolean;
+ onRestart?: () => void;
+}) {
+ if (status !== "exited" && status !== "error") return null;
+ const tone = NOTICE_TONE[status === "error" ? "error" : "warning"][
+ light ? "light" : "dark"
+ ];
+ /*
+ * The two details are written for different sentences and cannot be shown the
+ * same way. A trouble message is already one ("This terminal is no longer part
+ * of the open workspace."); an exit reason is a CLAUSE — `explainExit` returns
+ * "stopped", or "stopped unexpectedly (exit code 2) — use Restart to bring it
+ * back" — which needs the agent's name in front of it to be a sentence at all.
+ * Shown raw, a dead pane said nothing but "stopped".
+ */
+ const message =
+ status === "error"
+ ? detail || `${name} could not be reached.`
+ : detail
+ ? `${displayName} ${detail}`
+ : `${displayName} is no longer running in ${name}.`;
+ return (
+ <div
+ data-testid={`pane-notice-${name}`}
+ data-tone={status === "error" ? "error" : "warning"}
+ // Announced once, quietly. `polite` rather than `assertive`: a pane going
+ // quiet is news, but it is never more urgent than the sentence a screen
+ // reader is in the middle of.
+ role="status"
+ aria-live="polite"
+ // The shared section's notice shape — a rule down the left edge, no fill,
+ // no icon — one size down for a pane header's scale. A filled box here
+ // would read as a second, louder terminal sitting on top of the first.
+ className="flex shrink-0 items-center gap-2 border-l-2 px-2 py-1 text-[11px] leading-tight"
+ style={{ borderColor: tone.border, color: tone.text }}
+ >
+ <span className="min-w-0 flex-1 truncate" title={message}>
+ {message}
+ </span>
+ {onRestart && (
+ <button
+ type="button"
+ aria-label={`Restart ${name}`}
+ title={`Start a fresh ${displayName} in ${name}`}
+ data-testid={`pane-restart-${name}`}
+ onClick={(e) => {
+ e.stopPropagation();
+ onRestart();
+ }}
+ onMouseDown={(e) => e.stopPropagation()}
+ className={cn(
+ "flex shrink-0 items-center gap-1 rounded bg-primary/20 px-2 py-0.5",
+ "text-[11px] font-medium text-primary",
+ "transition-colors duration-150 hover:bg-primary/30",
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70",
+ )}
+ >
+ <RotateCcw className="h-3 w-3" aria-hidden="true" />
+ Restart
+ </button>
+ )}
+ </div>
+ );
+}
+
/*
* The pane badge used to live here and reported the SOCKET: "live" for any pane
* with a working pipe, which is nearly all of them nearly all of the time. It
diff --git a/jarvis/ui/web/frontend/src/components/agentic/controls.tsx b/jarvis/ui/web/frontend/src/components/agentic/controls.tsx
index bc94a67074..ff8d164932 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/controls.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/controls.tsx
@@ -31,6 +31,23 @@
import { forwardRef } from "react";
import { cn } from "@/lib/utils";
+/**
+ * The ONE way a control in this section says it has keyboard focus.
+ *
+ * Exported rather than kept private because the terminal panes cannot use the
+ * controls below and still need this: a pane header is coloured by the
+ * TERMINAL's appearance — a light pane inside a dark app is a supported
+ * combination — so its buttons carry their own palette rather than the theme's.
+ * What they must not carry is their own idea of what "focused" looks like.
+ *
+ * Until this became shared, the pane header simply had none: every one of its
+ * five actions was reachable by Tab and invisible once it got there, which on a
+ * wall of a dozen panes means a keyboard user has no way to tell which terminal
+ * they are about to close.
+ */
+export const FOCUS_RING =
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60";
+
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
/**
* `primary` starts something and there is at most one per screen; `quiet` is
@@ -43,7 +60,7 @@ type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
const BASE =
"inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-control px-3 " +
"text-sm font-medium transition-colors " +
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 " +
+ `${FOCUS_RING} ` +
"disabled:cursor-not-allowed disabled:opacity-40";
const VARIANTS: Record<NonNullable<ButtonProps["variant"]>, string> = {
@@ -100,7 +117,7 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
"inline-flex shrink-0 items-center justify-center rounded-control " +
"text-muted-foreground transition-colors " +
"hover:bg-secondary hover:text-foreground " +
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 " +
+ `${FOCUS_RING} ` +
"disabled:cursor-not-allowed disabled:opacity-40",
size === "sm" ? "h-6 w-6" : "h-8 w-8",
className,
@@ -136,34 +153,6 @@ export const Field = forwardRef<
);
});
-/**
- * A native select at the same scale.
- *
- * Native rather than a custom menu because the two places it is used — which
- * coding CLI runs in a pane, which subscription it opens on — are short lists
- * where the OS control is better than anything worth reimplementing: it is
- * keyboard-navigable, it scrolls, and on a phone it becomes the platform picker.
- */
-export const Select = forwardRef<
- HTMLSelectElement,
- React.SelectHTMLAttributes<HTMLSelectElement>
->(function Select({ className, children, ...rest }, ref) {
- return (
- <select
- ref={ref}
- className={cn(
- "h-8 max-w-full rounded-control border border-border bg-background px-2 text-sm " +
- "text-foreground outline-none transition-colors focus:border-primary/60 " +
- "disabled:cursor-not-allowed disabled:opacity-40",
- className,
- )}
- {...rest}
- >
- {children}
- </select>
- );
-});
-
/**
* A panel — the one container shape this section uses.
*
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts
index 050f3947d9..090ccac83f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts
@@ -82,13 +82,72 @@ export function themeFor(appearance: TerminalAppearance): ITheme {
return appearance === "dark" ? DARK_TERMINAL_THEME : LIGHT_TERMINAL_THEME;
}
+/**
+ * The lifecycle a pane's frame reports, mirroring `PaneStatus` in
+ * ./AgenticTerminal.
+ *
+ * Declared here rather than imported so the colour module stays a leaf — the
+ * terminal already imports this file, and a second edge would be a cycle. The
+ * two unions are checked against each other structurally at every use site:
+ * indexing `edge` with a `PaneStatus` stops compiling the moment one of them
+ * grows a member the other does not have, which is the point.
+ */
+export type PaneEdgeState = "connecting" | "live" | "exited" | "error";
+
+export interface PaneChrome {
+ /** The translucent ground the pane — header AND terminal — is drawn on. */
+ shell: string;
+ /** The pane's resting edge, and the rule under its header. */
+ border: string;
+ /** The edge that says what this pane's agent is doing. */
+ edge: Record<PaneEdgeState, string>;
+}
+
/**
* Chrome (pane frame) colours that go with each terminal theme.
*
* These alphas mirror the shared section-panel glass tokens. Keeping the tint
* on this single layer lets xterm remain clear while preserving text contrast.
+ *
+ * ## Why the edge is a state and not a decoration
+ *
+ * A wall of twelve panes has one thing every reader is looking for: which of
+ * them still needs them. The activity pill answers that per pane, but a pill is
+ * something you READ — you have to land on the pane first. The edge is what the
+ * eye can sweep, so it carries exactly one distinction and carries it quietly:
+ *
+ * * `connecting` / `live` — the resting edge. The overwhelming majority of
+ * panes are here, and a workspace where everything is marked marks nothing.
+ * * `exited` — dimmer than resting. The agent is gone; the pane recedes rather
+ * than shouting, because a finished terminal is not a problem.
+ * * `error` — the CLI's own red, at an alpha that reads across a room without
+ * turning the pane into an alert box.
+ *
+ * The red is the matching terminal theme's own `red` slot rather than the app's
+ * `--destructive`, and that is deliberate: terminal appearance is a separate
+ * setting from the app theme (a light pane inside a dark app is a supported
+ * combination), so a token picked for the app lands on the wrong ground exactly
+ * when the two disagree.
*/
-export const PANE_CHROME: Record<TerminalAppearance, { shell: string; border: string }> = {
- light: { shell: "rgba(252, 251, 248, 0.68)", border: "rgba(0,0,0,0.10)" },
- dark: { shell: "rgba(10, 10, 10, 0.58)", border: "rgba(255,255,255,0.10)" },
+export const PANE_CHROME: Record<TerminalAppearance, PaneChrome> = {
+ light: {
+ shell: "rgba(252, 251, 248, 0.68)",
+ border: "rgba(0,0,0,0.10)",
+ edge: {
+ connecting: "rgba(0,0,0,0.10)",
+ live: "rgba(0,0,0,0.10)",
+ exited: "rgba(0,0,0,0.05)",
+ error: "rgba(192,57,43,0.45)",
+ },
+ },
+ dark: {
+ shell: "rgba(10, 10, 10, 0.58)",
+ border: "rgba(255,255,255,0.10)",
+ edge: {
+ connecting: "rgba(255,255,255,0.10)",
+ live: "rgba(255,255,255,0.10)",
+ exited: "rgba(255,255,255,0.05)",
+ error: "rgba(255,107,94,0.50)",
+ },
+ },
};
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.test.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.test.ts
index 35dcf93feb..59dcb0cd7a 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.test.ts
@@ -1,6 +1,12 @@
import { describe, expect, it, vi } from "vitest";
-import { installZoomKeyBridge, zoomIntentFor, type ZoomIntent } from "./terminalZoom";
+import {
+ installZoomKeyBridge,
+ installZoomWheelBridge,
+ zoomIntentFor,
+ zoomIntentForWheel,
+ type ZoomIntent,
+} from "./terminalZoom";
function press(init: KeyboardEventInit): KeyboardEvent {
return new KeyboardEvent("keydown", { cancelable: true, ...init });
@@ -168,3 +174,185 @@ describe("the zoom key bridge", () => {
expect(target.listeners).toBe(0);
});
});
+
+function turn(init: WheelEventInit): WheelEvent {
+ return new WheelEvent("wheel", { cancelable: true, ...init });
+}
+
+describe("recognising Ctrl+wheel as a text-size gesture", () => {
+ it("reads a notch away from the user as bigger, and towards it as smaller", () => {
+ expect(zoomIntentForWheel(turn({ deltaY: -120, ctrlKey: true }))).toBe("in");
+ expect(zoomIntentForWheel(turn({ deltaY: 120, ctrlKey: true }))).toBe("out");
+ });
+
+ /*
+ * The one deliberate divergence from the KEY chord table, which refuses Ctrl
+ * on macOS. A pinch is delivered as a synthetic Ctrl+wheel with no key held,
+ * so requiring Cmd would leave the gesture a Mac user reaches for first doing
+ * nothing at all. See the note on `zoomIntentForWheel`.
+ */
+ it("takes the macOS trackpad pinch, which arrives as a synthetic Ctrl+wheel", () => {
+ expect(zoomIntentForWheel(turn({ deltaY: -8, ctrlKey: true }))).toBe("in");
+ });
+
+ it("leaves an ordinary scroll alone — that is the pane's own history", () => {
+ expect(zoomIntentForWheel(turn({ deltaY: -120 }))).toBeNull();
+ });
+
+ it("leaves the system gestures alone: AltGr, and Win/Cmd + wheel", () => {
+ expect(
+ zoomIntentForWheel(turn({ deltaY: -120, ctrlKey: true, altKey: true })),
+ ).toBeNull();
+ // Win+wheel is the Windows magnifier; Cmd+scroll is a zoom in no macOS app.
+ expect(
+ zoomIntentForWheel(turn({ deltaY: -120, ctrlKey: true, metaKey: true })),
+ ).toBeNull();
+ expect(zoomIntentForWheel(turn({ deltaY: -120, metaKey: true }))).toBeNull();
+ });
+
+ it("ignores a horizontal-only gesture rather than guessing a direction", () => {
+ expect(zoomIntentForWheel(turn({ deltaY: 0, ctrlKey: true }))).toBeNull();
+ });
+});
+
+/** A pane surface stand-in that records how the listener was registered. */
+function fakeWheelTarget(): {
+ addEventListener: EventTarget["addEventListener"];
+ removeEventListener: EventTarget["removeEventListener"];
+ fire: (event: WheelEvent) => void;
+ options: AddEventListenerOptions | undefined;
+ listeners: number;
+} {
+ const handlers = new Set<EventListener>();
+ const state = {
+ addEventListener: ((_type: string, handler: EventListener, options?: unknown) => {
+ state.options = options as AddEventListenerOptions;
+ handlers.add(handler);
+ state.listeners = handlers.size;
+ }) as EventTarget["addEventListener"],
+ removeEventListener: ((_type: string, handler: EventListener) => {
+ handlers.delete(handler);
+ state.listeners = handlers.size;
+ }) as EventTarget["removeEventListener"],
+ fire: (event: WheelEvent) => {
+ for (const handler of handlers) handler(event);
+ },
+ options: undefined as AddEventListenerOptions | undefined,
+ listeners: 0,
+ };
+ return state;
+}
+
+describe("the zoom wheel bridge", () => {
+ it("steps once per mouse notch and claims the gesture from the WebView", () => {
+ const target = fakeWheelTarget();
+ const applied: ZoomIntent[] = [];
+ installZoomWheelBridge(target, { apply: (intent) => applied.push(intent) });
+
+ const event = turn({ deltaY: -120, ctrlKey: true });
+ const stopPropagation = vi.spyOn(event, "stopPropagation");
+ target.fire(event);
+
+ expect(applied).toEqual(["in"]);
+ expect(event.defaultPrevented).toBe(true);
+ expect(stopPropagation).toHaveBeenCalled();
+ // Ahead of xterm's own wheel handling and of the pane's scroll containment,
+ // and cancellable — a passive listener could not stop the page zoom.
+ expect(target.options).toMatchObject({ capture: true, passive: false });
+ });
+
+ /*
+ * The whole reason the bridge accumulates. A pinch reports a stream of small
+ * deltas, and one step each took a pane across the full 10-20 px range in a
+ * single gesture.
+ */
+ it("accumulates a trackpad pinch into one step per threshold of travel", () => {
+ const target = fakeWheelTarget();
+ const applied: ZoomIntent[] = [];
+ installZoomWheelBridge(target, { apply: (intent) => applied.push(intent) });
+
+ for (let i = 0; i < 3; i += 1) {
+ const partial = turn({ deltaY: -10, ctrlKey: true });
+ target.fire(partial);
+ // Cancelled on the way to the threshold too, or the app page-zooms
+ // underneath the pane while the fingers are still moving.
+ expect(partial.defaultPrevented).toBe(true);
+ }
+ expect(applied).toEqual([]);
+
+ target.fire(turn({ deltaY: -10, ctrlKey: true }));
+ expect(applied).toEqual(["in"]);
+ });
+
+ it("spends nothing it banked the other way when the gesture turns around", () => {
+ const target = fakeWheelTarget();
+ const applied: ZoomIntent[] = [];
+ installZoomWheelBridge(target, { apply: (intent) => applied.push(intent) });
+
+ target.fire(turn({ deltaY: -30, ctrlKey: true }));
+ // A correction takes effect on its own travel, rather than crossing the
+ // threshold instantly on the back of the 30 px spent going the other way.
+ target.fire(turn({ deltaY: 30, ctrlKey: true }));
+ expect(applied).toEqual([]);
+
+ target.fire(turn({ deltaY: 10, ctrlKey: true }));
+ expect(applied).toEqual(["out"]);
+ });
+
+ it("steps immediately for a device that reports lines rather than pixels", () => {
+ const target = fakeWheelTarget();
+ const applied: ZoomIntent[] = [];
+ installZoomWheelBridge(target, { apply: (intent) => applied.push(intent) });
+
+ // deltaMode 1 = DOM_DELTA_LINE: the device has already quantised it.
+ target.fire(turn({ deltaY: -1, deltaMode: 1, ctrlKey: true }));
+ expect(applied).toEqual(["in"]);
+ });
+
+ it("never steps more than once for one coalesced burst", () => {
+ const target = fakeWheelTarget();
+ const applied: ZoomIntent[] = [];
+ installZoomWheelBridge(target, { apply: (intent) => applied.push(intent) });
+
+ // Four thresholds' worth in a single event. A size that jumps four steps
+ // reads as having been yanked rather than adjusted.
+ target.fire(turn({ deltaY: -160, ctrlKey: true }));
+ expect(applied).toEqual(["in"]);
+ });
+
+ it("hands an ordinary scroll straight on to the terminal's history", () => {
+ const target = fakeWheelTarget();
+ const apply = vi.fn();
+ installZoomWheelBridge(target, { apply });
+
+ const event = turn({ deltaY: -120 });
+ target.fire(event);
+
+ expect(apply).not.toHaveBeenCalled();
+ expect(event.defaultPrevented).toBe(false);
+ });
+
+ it("stands down while the surface it belongs to is not being looked at", () => {
+ const target = fakeWheelTarget();
+ const apply = vi.fn();
+ let onScreen = false;
+ installZoomWheelBridge(target, { enabled: () => onScreen, apply });
+
+ const hidden = turn({ deltaY: -120, ctrlKey: true });
+ target.fire(hidden);
+ expect(apply).not.toHaveBeenCalled();
+ expect(hidden.defaultPrevented).toBe(false);
+
+ onScreen = true;
+ target.fire(turn({ deltaY: -120, ctrlKey: true }));
+ expect(apply).toHaveBeenCalledWith("in");
+ });
+
+ it("removes its listener on cleanup", () => {
+ const target = fakeWheelTarget();
+ const dispose = installZoomWheelBridge(target, { apply: vi.fn() });
+ expect(target.listeners).toBe(1);
+ dispose();
+ expect(target.listeners).toBe(0);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.ts
index 6c1b7c4c46..75ec283b73 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalZoom.ts
@@ -1,5 +1,6 @@
/**
- * Ctrl/Cmd + `+` / `-` / `0` resizes the terminal text, the way a browser zooms.
+ * Ctrl/Cmd + `+` / `-` / `0` — and Ctrl + wheel — resize the terminal text, the
+ * way a browser zooms.
*
* ## Why this file has to exist
*
@@ -64,7 +65,48 @@ export function zoomIntentFor(
return null;
}
-export interface ZoomKeyBridgeOptions extends ZoomChordOptions {
+/**
+ * How much accumulated wheel travel counts as one step of text size.
+ *
+ * A mouse notch reports 100-120 px in one event, so it steps immediately. A
+ * trackpad pinch reports a stream of 1-10 px deltas instead, and treating each
+ * as a step took a pane from 10 px to 20 px in a single gesture — past both
+ * clamps before the fingers had stopped moving. Accumulating to a threshold
+ * makes both devices step at roughly the same rate.
+ */
+const WHEEL_STEP_DELTA = 40;
+
+/**
+ * What this wheel event means for the terminal text size, or `null` when it is
+ * ordinary scrolling.
+ *
+ * ## Why `ctrlKey` on every platform, including macOS
+ *
+ * This is the one place the key chord's rule is deliberately NOT mirrored. The
+ * chord table above refuses Ctrl on macOS because Ctrl+<key> is a control code
+ * inside a terminal — but that is a property of KEYS, and a wheel notch is
+ * never a control code. What Ctrl+wheel is on every platform is the zoom
+ * gesture: the browser's own, VS Code's `editor.mouseWheelZoom`, and — the part
+ * that decides it — a macOS trackpad PINCH, which the engine delivers as a
+ * synthetic wheel event with `ctrlKey` set and no key pressed at all. Requiring
+ * Cmd there would leave pinch-to-zoom, the gesture a Mac user reaches for
+ * first, doing nothing.
+ *
+ * Cmd is therefore disqualifying rather than accepted: on macOS Cmd+scroll is
+ * not a zoom in any application, and on Windows Win+wheel belongs to the
+ * system magnifier. Alt is disqualifying for the same reason as above — AltGr
+ * arrives as Ctrl+Alt on European layouts.
+ */
+export function zoomIntentForWheel(
+ event: Pick<WheelEvent, "deltaY" | "ctrlKey" | "metaKey" | "altKey">,
+): Extract<ZoomIntent, "in" | "out"> | null {
+ if (!event.ctrlKey || event.metaKey || event.altKey) return null;
+ if (event.deltaY === 0) return null;
+ // Away from the user is "bigger", the same direction every browser zooms.
+ return event.deltaY < 0 ? "in" : "out";
+}
+
+export interface ZoomBridgeOptions {
/**
* Is the workspace the user is actually looking at?
*
@@ -72,12 +114,22 @@ export interface ZoomKeyBridgeOptions extends ZoomChordOptions {
* hidden instead of unmounted when another section is opened — a grid parked
* behind the settings screen must not resize its panes while the user zooms
* something else.
+ *
+ * Optional for a bridge bound to one pane's own surface: an element that
+ * cannot be seen cannot be scrolled over either, so there is nothing left to
+ * ask.
*/
- enabled: () => boolean;
+ enabled?: () => boolean;
/** Apply the step. Clamping and remembering it belong to the caller. */
apply: (intent: ZoomIntent) => void;
}
+export interface ZoomKeyBridgeOptions
+ extends ZoomChordOptions, ZoomBridgeOptions {
+ /** The key bridge is installed once for a whole grid, so it must be asked. */
+ enabled: () => boolean;
+}
+
/**
* Claim the zoom chords on `target`, returning a cleanup function.
*
@@ -106,3 +158,71 @@ export function installZoomKeyBridge(
target.addEventListener("keydown", onKeyDown, true);
return () => target.removeEventListener("keydown", onKeyDown, true);
}
+
+/**
+ * Claim Ctrl+wheel on `target` as a text-size gesture, returning a cleanup
+ * function.
+ *
+ * Bound to one pane's terminal surface rather than to the window, unlike the
+ * key bridge: a chord typed anywhere in the workspace plausibly means "the text
+ * I am reading", but a wheel gesture has a definite place under the pointer, and
+ * zooming every terminal because someone pinched over the file tree would be a
+ * surprise. Whatever the gesture lands on is what it is about.
+ *
+ * Three details are load-bearing:
+ *
+ * * **`passive: false`.** Browsers make `wheel` listeners on window/document
+ * passive by DEFAULT, and a passive listener may not cancel anything — the
+ * WebView would zoom the whole app underneath the pane. Declared explicitly so
+ * the same call is safe wherever it is bound.
+ * * **Capture phase.** The pane's own surface stops wheel events from reaching
+ * the workspace scroller (see ./terminalScrollSurface) and xterm scrolls its
+ * history from a listener of its own. Capturing puts this ahead of both.
+ * * **Cancelled even below the step threshold.** A pinch that has not yet
+ * travelled far enough to change the size is still a zoom gesture, and letting
+ * that one through would page-zoom the app on the way to the size the user
+ * asked for.
+ */
+export function installZoomWheelBridge(
+ target: Pick<EventTarget, "addEventListener" | "removeEventListener">,
+ { enabled, apply }: ZoomBridgeOptions,
+): () => void {
+ /** Signed wheel travel not yet spent on a step. */
+ let travel = 0;
+
+ const onWheel = (event: Event) => {
+ const wheel = event as WheelEvent;
+ if (enabled && !enabled()) return;
+ const intent = zoomIntentForWheel(wheel);
+ if (intent === null) {
+ travel = 0;
+ return;
+ }
+ // Before the threshold, deliberately — see the note above.
+ event.preventDefault();
+ event.stopPropagation();
+ // A device that reports lines or pages has already quantised the gesture
+ // for us; only pixel deltas need accumulating.
+ if (wheel.deltaMode !== 0) {
+ travel = 0;
+ apply(intent);
+ return;
+ }
+ // Turning around mid-gesture spends nothing it had banked the other way,
+ // so a correction takes effect on the next notch rather than two later.
+ if (travel !== 0 && Math.sign(travel) !== Math.sign(wheel.deltaY))
+ travel = 0;
+ travel += wheel.deltaY;
+ const steps = Math.floor(Math.abs(travel) / WHEEL_STEP_DELTA);
+ if (steps === 0) return;
+ travel -= Math.sign(travel) * steps * WHEEL_STEP_DELTA;
+ // One step per event however far a coalesced burst travelled. The clamp
+ // lives in the caller, and a pinch that jumped four steps at once reads as
+ // the size having been yanked rather than adjusted.
+ apply(intent);
+ };
+
+ target.addEventListener("wheel", onWheel, { capture: true, passive: false });
+ return () =>
+ target.removeEventListener("wheel", onWheel, { capture: true } as never);
+}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.test.tsx
index 10660786aa..3202a98efa 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.test.tsx
@@ -11,10 +11,11 @@ vi.mock("@/i18n", () => ({
import { LanguageStep } from "./LanguageStep";
afterEach(() => { cleanup(); setUiLanguage.mockClear(); });
-it("changes UI language and advances", () => {
+it("changes UI language and advances", async () => {
const goNext = vi.fn();
render(<LanguageStep onb={{} as never} goNext={goNext} goBack={vi.fn()} skip={vi.fn()} isFirst={false} isLast={false} />);
- fireEvent.change(screen.getByLabelText("onboarding.language.ui_label"), { target: { value: "de" } });
+ fireEvent.click(screen.getByLabelText("onboarding.language.ui_label"));
+ fireEvent.click(await screen.findByText("Deutsch"));
expect(setUiLanguage).toHaveBeenCalledWith("de");
fireEvent.click(screen.getByRole("button", { name: "onboarding.nav.next" }));
expect(goNext).toHaveBeenCalled();
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.tsx
index 14f1deb7ff..4af70fa6a6 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.tsx
@@ -1,4 +1,5 @@
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import {
useT,
useUiLanguage,
@@ -19,30 +20,32 @@ export function LanguageStep({ goNext }: StepProps) {
<h2 className="font-display text-lg font-semibold">{t("onboarding.language.title")}</h2>
<label className="text-sm">
{t("onboarding.language.ui_label")}
- <select
- aria-label={t("onboarding.language.ui_label")}
+ <BrandedSelect
+ ariaLabel={t("onboarding.language.ui_label")}
value={ui}
- onChange={(e) => setUiLanguage(e.target.value as UiLanguage)}
- className="mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"
- >
- <option value="en">English</option>
- <option value="de">Deutsch</option>
- <option value="es">Español</option>
- </select>
+ onValueChange={(value) => setUiLanguage(value as UiLanguage)}
+ options={[
+ { value: "en", label: "English" },
+ { value: "de", label: "Deutsch" },
+ { value: "es", label: "Español" },
+ ]}
+ className="mt-1"
+ />
</label>
<label className="text-sm">
{t("onboarding.language.reply_label")}
- <select
- aria-label={t("onboarding.language.reply_label")}
+ <BrandedSelect
+ ariaLabel={t("onboarding.language.reply_label")}
value={reply}
- onChange={(e) => setReplyLanguage(e.target.value as ReplyLanguage)}
- className="mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"
- >
- <option value="auto">Auto</option>
- <option value="en">English</option>
- <option value="de">Deutsch</option>
- <option value="es">Español</option>
- </select>
+ onValueChange={(value) => setReplyLanguage(value as ReplyLanguage)}
+ options={[
+ { value: "auto", label: "Auto" },
+ { value: "en", label: "English" },
+ { value: "de", label: "Deutsch" },
+ { value: "es", label: "Español" },
+ ]}
+ className="mt-1"
+ />
</label>
<Button className="w-full" onClick={goNext}>{t("onboarding.nav.next")}</Button>
</div>
diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx
index 9d16054cfa..f087fab7fb 100644
--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx
@@ -1092,10 +1092,11 @@ describe("managed local realtime model setup", () => {
expect(screen.getByText("Browse the full Ollama catalog")).toBeTruthy();
expect(screen.getByText("Browse open-source speech models")).toBeTruthy();
expect(screen.getByText("Advanced connection settings")).toBeTruthy();
- const unavailable = screen.getByRole("option", {
+ fireEvent.click(screen.getByRole("combobox", { name: "Speak" }));
+ const unavailable = await screen.findByRole("option", {
name: /ChatTTS.*not voice-tested yet/,
- }) as HTMLOptionElement;
- expect(unavailable.disabled).toBe(true);
+ });
+ expect(unavailable.getAttribute("aria-disabled")).toBe("true");
expect(calls.some((call) => call.url.endsWith("/model-catalog"))).toBe(true);
fireEvent.click(screen.getByText("Browse open-source speech models"));
diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
index 76968dafb8..3cbad789c5 100644
--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
@@ -8,6 +8,7 @@ import { CuModelSelector } from "@/components/CuModelSelector";
import { RealtimeOptionsControl } from "@/components/RealtimeOptionsControl";
import { ProviderBillingBadge } from "@/components/ProviderBillingBadge";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import {
codexLogout,
loginAntigravity,
@@ -2361,21 +2362,26 @@ function ManagedServerPanel({
<Brain className="h-3.5 w-3.5 text-muted-foreground" />
{t("apikeys_view.managed_thinking_title")}
</span>
- <select
- aria-label={t("apikeys_view.managed_thinking_title")}
+ <BrandedSelect
+ ariaLabel={t("apikeys_view.managed_thinking_title")}
value={selectedBrain}
- onChange={(event) => setSelectedBrain(event.target.value)}
+ onValueChange={setSelectedBrain}
disabled={setupBusy}
- className="h-8 w-full rounded-md border border-border bg-background px-2 text-xs"
- >
- {catalog.brain.models.map((choice) => (
- <option key={choice.id} value={choice.id} disabled={!choice.fits}>
- {choice.label} · ~{choice.size_gb} GB
- {choice.recommended ? ` · ${t("apikeys_view.managed_brain_recommended")}` : ""}
- {!choice.fits ? ` · ${t("apikeys_view.managed_brain_no_fit")}` : ""}
- </option>
- ))}
- </select>
+ className="h-8 px-2 text-xs"
+ options={catalog.brain.models.map((choice) => ({
+ value: choice.id,
+ label: `${choice.label} · ~${choice.size_gb} GB${
+ choice.recommended
+ ? ` · ${t("apikeys_view.managed_brain_recommended")}`
+ : ""
+ }${
+ choice.fits
+ ? ""
+ : ` · ${t("apikeys_view.managed_brain_no_fit")}`
+ }`,
+ disabled: !choice.fits,
+ }))}
+ />
</label>
<label className="space-y-1 rounded-md border border-border/60 bg-background/50 p-2">
@@ -2383,29 +2389,28 @@ function ManagedServerPanel({
<Volume2 className="h-3.5 w-3.5 text-muted-foreground" />
{t("apikeys_view.managed_speaking_title")}
</span>
- <select
- aria-label={t("apikeys_view.managed_speaking_title")}
+ <BrandedSelect
+ ariaLabel={t("apikeys_view.managed_speaking_title")}
value={selectedVoice}
- onChange={(event) => setSelectedVoice(event.target.value)}
+ onValueChange={setSelectedVoice}
disabled={setupBusy}
- className="h-8 w-full rounded-md border border-border bg-background px-2 text-xs"
- >
- {catalog.models.map((choice) => (
- <option
- key={choice.id}
- value={choice.id}
- disabled={!choice.selectable}
- >
- {choice.label}
- {choice.recommended ? ` · ${t("apikeys_view.managed_brain_recommended")}` : ""}
- {!choice.selectable
+ className="h-8 px-2 text-xs"
+ options={catalog.models.map((choice) => ({
+ value: choice.id,
+ label: `${choice.label}${
+ choice.recommended
+ ? ` · ${t("apikeys_view.managed_brain_recommended")}`
+ : ""
+ }${
+ !choice.selectable
? ` · ${t("apikeys_view.managed_voice_unavailable")}`
: choice.runtime_ready === false
? ` · ${t("apikeys_view.managed_voice_install_required")}`
- : ""}
- </option>
- ))}
- </select>
+ : ""
+ }`,
+ disabled: !choice.selectable,
+ }))}
+ />
</label>
</div>
diff --git a/jarvis/ui/web/frontend/src/components/ui/combobox.test.tsx b/jarvis/ui/web/frontend/src/components/ui/combobox.test.tsx
new file mode 100644
index 0000000000..83e087b360
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ui/combobox.test.tsx
@@ -0,0 +1,115 @@
+import { fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { Combobox } from "@/components/ui/combobox";
+
+const GROUPS = [
+ {
+ id: "main",
+ options: [
+ { value: "alpha", label: "Alpha" },
+ { value: "blocked", label: "Blocked", disabled: true },
+ { value: "charlie", label: "Charlie" },
+ ],
+ },
+];
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("Combobox non-search listbox accessibility", () => {
+ it("exposes the active option through a stable aria-activedescendant", async () => {
+ render(
+ <Combobox
+ value="alpha"
+ groups={GROUPS}
+ onChange={() => {}}
+ ariaLabel="Example choice"
+ />,
+ );
+
+ fireEvent.click(screen.getByRole("combobox", { name: "Example choice" }));
+ const listbox = await screen.findByRole("listbox", {
+ name: "Example choice",
+ });
+ const alpha = screen.getByRole("option", { name: "Alpha" });
+
+ await waitFor(() => expect(document.activeElement).toBe(listbox));
+ expect(alpha.id).not.toBe("");
+ expect(listbox.getAttribute("aria-activedescendant")).toBe(alpha.id);
+
+ fireEvent.keyDown(listbox, { key: "ArrowDown" });
+ const charlie = screen.getByRole("option", { name: "Charlie" });
+ expect(listbox.getAttribute("aria-activedescendant")).toBe(charlie.id);
+
+ fireEvent.keyDown(listbox, { key: "Home" });
+ expect(listbox.getAttribute("aria-activedescendant")).toBe(alpha.id);
+
+ fireEvent.keyDown(listbox, { key: "End" });
+ expect(listbox.getAttribute("aria-activedescendant")).toBe(charlie.id);
+ });
+
+ it("commits the keyboard-active enabled option", async () => {
+ const onChange = vi.fn();
+ render(
+ <Combobox
+ value="alpha"
+ groups={GROUPS}
+ onChange={onChange}
+ ariaLabel="Example choice"
+ />,
+ );
+
+ fireEvent.click(screen.getByRole("combobox", { name: "Example choice" }));
+ const listbox = await screen.findByRole("listbox", {
+ name: "Example choice",
+ });
+ fireEvent.keyDown(listbox, { key: "ArrowDown" });
+ fireEvent.keyDown(listbox, { key: "Enter" });
+
+ expect(onChange).toHaveBeenCalledWith("charlie");
+ });
+
+ it("tracks duplicate values as distinct active occurrences", async () => {
+ const onChange = vi.fn();
+ render(
+ <Combobox
+ value="baseline"
+ groups={[
+ {
+ id: "common",
+ options: [
+ { value: "english", label: "English (Common)" },
+ { value: "baseline", label: "Baseline" },
+ ],
+ },
+ {
+ id: "all",
+ options: [
+ { value: "english", label: "English (All)" },
+ { value: "spanish", label: "Spanish" },
+ ],
+ },
+ ]}
+ onChange={onChange}
+ ariaLabel="Language"
+ />,
+ );
+
+ fireEvent.click(screen.getByRole("combobox", { name: "Language" }));
+ const listbox = await screen.findByRole("listbox", { name: "Language" });
+ const [commonEnglish, allEnglish] = screen.getAllByRole("option", {
+ name: /English/,
+ });
+
+ expect(commonEnglish.id).not.toBe(allEnglish.id);
+ fireEvent.keyDown(listbox, { key: "ArrowDown" });
+ fireEvent.keyDown(listbox, { key: "ArrowDown" });
+ expect(listbox.getAttribute("aria-activedescendant")).toBe(allEnglish.id);
+ expect(document.querySelectorAll('[data-active="true"]')).toHaveLength(1);
+
+ fireEvent.keyDown(listbox, { key: "Enter" });
+ expect(onChange).toHaveBeenCalledWith("english");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/ui/combobox.tsx b/jarvis/ui/web/frontend/src/components/ui/combobox.tsx
index 7cd14ebf1e..f4674cc942 100644
--- a/jarvis/ui/web/frontend/src/components/ui/combobox.tsx
+++ b/jarvis/ui/web/frontend/src/components/ui/combobox.tsx
@@ -43,6 +43,8 @@ export interface ComboboxOption {
/** Extra text a matcher may search but that is never rendered. */
searchText?: string;
icon?: ReactNode;
+ /** Listed for context, but cannot be selected. */
+ disabled?: boolean;
}
export interface ComboboxGroup {
@@ -68,6 +70,8 @@ export interface ComboboxProps {
matches?: (option: ComboboxOption, query: string) => boolean;
disabled?: boolean;
className?: string;
+ id?: string;
+ ariaDescribedBy?: string;
/** Lands on the trigger button; the panel gets `${testId}-panel`. */
testId?: string;
}
@@ -102,6 +106,21 @@ interface PanelPosition {
maxHeight: number;
}
+interface OptionOccurrence {
+ option: ComboboxOption;
+ id: string;
+}
+
+function optionOccurrenceId(
+ listId: string,
+ groupId: string,
+ groupIndex: number,
+ optionIndex: number,
+ value: string,
+): string {
+ return `${listId}-option-${encodeURIComponent(groupId)}-${groupIndex}-${optionIndex}-${encodeURIComponent(value)}`;
+}
+
export function Combobox({
value,
groups,
@@ -113,6 +132,8 @@ export function Combobox({
matches = defaultMatches,
disabled = false,
className,
+ id,
+ ariaDescribedBy,
testId,
}: ComboboxProps) {
const [open, setOpen] = useState(false);
@@ -158,10 +179,28 @@ export function Combobox({
return hits.length ? [{ id: "results", options: hits }] : [];
}, [groups, matches, query]);
- // Flat order of what is on screen — arrow keys walk this, not the groups.
- const flat = useMemo(
- () => visibleGroups.flatMap((group) => group.options),
- [visibleGroups],
+ // Flat order of concrete rendered occurrences — arrow keys walk this, not
+ // merely option values. A shortlist may repeat the same logical value in the
+ // full group, so every occurrence needs its own DOM id and active state.
+ const flat = useMemo<OptionOccurrence[]>(
+ () =>
+ visibleGroups.flatMap((group, groupIndex) =>
+ group.options.map((option, optionIndex) => ({
+ option,
+ id: optionOccurrenceId(
+ listId,
+ group.id,
+ groupIndex,
+ optionIndex,
+ option.value,
+ ),
+ })),
+ ),
+ [listId, visibleGroups],
+ );
+ const enabled = useMemo(
+ () => flat.filter(({ option }) => !option.disabled),
+ [flat],
);
const measure = useCallback(() => {
@@ -234,7 +273,7 @@ export function Combobox({
// Open on the current value so the list starts where the user left it.
useEffect(() => {
if (!open) return;
- const index = flat.findIndex((option) => option.value === value);
+ const index = enabled.findIndex(({ option }) => option.value === value);
setActiveIndex(index >= 0 ? index : 0);
// Only on open: while typing, the query effect below owns the highlight.
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -275,6 +314,7 @@ export function Combobox({
}, [open, close]);
function commit(option: ComboboxOption) {
+ if (option.disabled) return;
close();
if (option.value !== value) onChange(option.value);
}
@@ -291,20 +331,24 @@ export function Combobox({
}
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
event.preventDefault();
- if (!flat.length) return;
+ if (!enabled.length) return;
const step = event.key === "ArrowDown" ? 1 : -1;
- setActiveIndex((index) => (index + step + flat.length) % flat.length);
+ setActiveIndex(
+ (index) => (index + step + enabled.length) % enabled.length,
+ );
return;
}
if (event.key === "Home" || event.key === "End") {
event.preventDefault();
- setActiveIndex(event.key === "Home" ? 0 : Math.max(0, flat.length - 1));
+ setActiveIndex(
+ event.key === "Home" ? 0 : Math.max(0, enabled.length - 1),
+ );
return;
}
if (event.key === "Enter") {
event.preventDefault();
- const option = flat[activeIndex];
- if (option) commit(option);
+ const occurrence = enabled[activeIndex];
+ if (occurrence) commit(occurrence.option);
}
}
@@ -316,27 +360,30 @@ export function Combobox({
}
const triggerLabel = selected?.label ?? fallbackLabel ?? value;
- const activeOption = flat[activeIndex];
+ const activeOption = enabled[activeIndex];
return (
<>
<button
ref={triggerRef}
+ id={id}
type="button"
role="combobox"
aria-haspopup="listbox"
aria-expanded={open}
aria-controls={open ? listId : undefined}
aria-label={ariaLabel}
+ aria-describedby={ariaDescribedBy}
disabled={disabled}
data-testid={testId}
data-value={value}
onClick={() => !disabled && setOpen((wasOpen) => !wasOpen)}
onKeyDown={onTriggerKeyDown}
className={cn(
- "flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-left text-sm transition-colors",
- "hover:border-primary/40 focus:outline-none focus-visible:border-primary/60 focus-visible:ring-1 focus-visible:ring-primary",
- open && "border-primary/60 ring-1 ring-primary",
+ "flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-left text-sm",
+ "shadow-[inset_0_1px_0_hsl(var(--foreground)/0.04)] transition-[border-color,background-color,box-shadow]",
+ "hover:border-primary/40 hover:bg-muted/20 focus:outline-none focus-visible:border-primary/60 focus-visible:ring-1 focus-visible:ring-primary/70",
+ open && "border-primary/60 bg-primary/[0.03] ring-1 ring-primary/70",
disabled && "cursor-not-allowed opacity-50",
className,
)}
@@ -370,7 +417,7 @@ export function Combobox({
maxHeight: position.maxHeight,
}}
onKeyDown={onKeyDown}
- className="fixed z-[70] flex flex-col overflow-hidden rounded-lg border border-border bg-popover shadow-[0_18px_40px_-12px_rgba(0,0,0,0.85)]"
+ className="fixed z-[70] flex flex-col overflow-hidden rounded-lg border border-primary/25 bg-popover/95 shadow-[0_22px_55px_-16px_rgba(0,0,0,0.9),inset_0_1px_0_hsl(var(--foreground)/0.05)] backdrop-blur-xl"
>
{searchable && (
<div className="flex items-center gap-2 border-b border-border/70 px-3 py-2">
@@ -387,7 +434,7 @@ export function Combobox({
aria-controls={listId}
aria-autocomplete="list"
aria-activedescendant={
- activeOption ? `${listId}-${activeOption.value}` : undefined
+ activeOption?.id
}
data-testid={testId ? `${testId}-search` : undefined}
className="w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"
@@ -400,6 +447,9 @@ export function Combobox({
id={listId}
role="listbox"
aria-label={ariaLabel}
+ aria-activedescendant={
+ !searchable ? activeOption?.id : undefined
+ }
tabIndex={searchable ? -1 : 0}
className="scrollbar-jarvis flex-1 overflow-y-auto p-1"
>
@@ -412,35 +462,49 @@ export function Combobox({
</p>
)}
- {visibleGroups.map((group) => (
+ {visibleGroups.map((group, groupIndex) => (
<div key={group.id}>
{group.label && (
<div className="px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">
{group.label}
</div>
)}
- {group.options.map((option) => {
- const isActive = activeOption?.value === option.value;
+ {group.options.map((option, optionIndex) => {
+ const occurrenceId = optionOccurrenceId(
+ listId,
+ group.id,
+ groupIndex,
+ optionIndex,
+ option.value,
+ );
+ const isActive = activeOption?.id === occurrenceId;
const isSelected = option.value === value;
return (
<div
key={option.value}
- id={`${listId}-${option.value}`}
+ id={occurrenceId}
role="option"
aria-selected={isSelected}
+ aria-disabled={option.disabled || undefined}
data-active={isActive}
data-value={option.value}
// Pointer, not mouse: the highlight has to follow a
// pen or touch drag as well, and `onMouseMove` never
// fires for either.
- onPointerMove={() =>
- setActiveIndex(flat.indexOf(option))
- }
+ onPointerMove={() => {
+ if (!option.disabled) {
+ setActiveIndex(
+ enabled.findIndex(({ id }) => id === occurrenceId),
+ );
+ }
+ }}
onClick={() => commit(option)}
className={cn(
- "flex cursor-pointer items-center gap-2 rounded-md px-3 py-1.5 text-sm",
- isActive && "bg-primary/10 text-foreground",
- isSelected && "font-medium",
+ "relative flex cursor-pointer items-center gap-2 rounded-md border border-transparent px-3 py-1.5 text-sm transition-colors",
+ isActive && "border-primary/15 bg-primary/10 text-foreground",
+ isSelected && "bg-primary/15 font-medium text-primary",
+ option.disabled &&
+ "cursor-not-allowed text-muted-foreground/45",
)}
>
{option.icon}
diff --git a/jarvis/ui/web/frontend/src/components/ui/no-native-selects.test.ts b/jarvis/ui/web/frontend/src/components/ui/no-native-selects.test.ts
new file mode 100644
index 0000000000..79c5ca71bf
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ui/no-native-selects.test.ts
@@ -0,0 +1,51 @@
+import { readdirSync, readFileSync } from "node:fs";
+import { join, relative } from "node:path";
+import * as ts from "typescript";
+import { describe, expect, it } from "vitest";
+
+const SOURCE_ROOT = join(process.cwd(), "src");
+
+function sourceFiles(directory: string): string[] {
+ return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
+ const path = join(directory, entry.name);
+ if (entry.isDirectory()) return sourceFiles(path);
+ if (!entry.name.endsWith(".tsx") || entry.name.includes(".test.")) return [];
+ return [path];
+ });
+}
+
+describe("dropdown design guard", () => {
+ it("keeps operating-system select popups out of product code", () => {
+ const violations: string[] = [];
+
+ for (const path of sourceFiles(SOURCE_ROOT)) {
+ const source = ts.createSourceFile(
+ path,
+ readFileSync(path, "utf8"),
+ ts.ScriptTarget.Latest,
+ true,
+ ts.ScriptKind.TSX,
+ );
+
+ function visit(node: ts.Node): void {
+ if (
+ (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) &&
+ node.tagName.getText(source) === "select"
+ ) {
+ const position = source.getLineAndCharacterOfPosition(node.getStart(source));
+ violations.push(
+ `${relative(SOURCE_ROOT, path)}:${position.line + 1}`,
+ );
+ }
+ ts.forEachChild(node, visit);
+ }
+
+ visit(source);
+ }
+
+ expect(
+ violations,
+ "Use BrandedSelect or Combobox so the opened menu follows the app theme.",
+ ).toEqual([]);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/ui/select.test.tsx b/jarvis/ui/web/frontend/src/components/ui/select.test.tsx
new file mode 100644
index 0000000000..dc2fdd4851
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ui/select.test.tsx
@@ -0,0 +1,55 @@
+import { fireEvent, render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+
+import { BrandedSelect } from "@/components/ui/select";
+
+describe("BrandedSelect", () => {
+ it("renders the app-owned panel and selects with the keyboard", async () => {
+ const onValueChange = vi.fn();
+ render(
+ <BrandedSelect
+ value="fast"
+ onValueChange={onValueChange}
+ ariaLabel="Model"
+ testId="model-select"
+ options={[
+ { value: "fast", label: "Fast" },
+ { value: "offline", label: "Unavailable", disabled: true },
+ { value: "frontier", label: "Frontier" },
+ ]}
+ />,
+ );
+
+ fireEvent.click(screen.getByTestId("model-select"));
+ const panel = await screen.findByTestId("model-select-panel");
+ expect(panel.className).toContain("bg-popover");
+
+ const unavailable = screen.getByRole("option", { name: "Unavailable" });
+ expect(unavailable.getAttribute("aria-disabled")).toBe("true");
+ fireEvent.click(unavailable);
+ expect(onValueChange).not.toHaveBeenCalled();
+
+ fireEvent.keyDown(panel, { key: "ArrowDown" });
+ fireEvent.keyDown(panel, { key: "Enter" });
+ expect(onValueChange).toHaveBeenCalledWith("frontier");
+ });
+
+ it("keeps the selected value on the trigger for forms and tests", () => {
+ render(
+ <BrandedSelect
+ value="voice-b"
+ onValueChange={() => {}}
+ ariaLabel="Voice"
+ testId="voice-select"
+ options={[
+ { value: "voice-a", label: "Voice A" },
+ { value: "voice-b", label: "Voice B" },
+ ]}
+ />,
+ );
+
+ const trigger = screen.getByTestId("voice-select");
+ expect(trigger.getAttribute("data-value")).toBe("voice-b");
+ expect(trigger.textContent).toContain("Voice B");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/ui/select.tsx b/jarvis/ui/web/frontend/src/components/ui/select.tsx
new file mode 100644
index 0000000000..0a91b8b059
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ui/select.tsx
@@ -0,0 +1,69 @@
+import { useMemo } from "react";
+
+import {
+ Combobox,
+ type ComboboxGroup,
+ type ComboboxOption,
+} from "@/components/ui/combobox";
+
+export type BrandedSelectOption = ComboboxOption;
+
+export interface BrandedSelectProps {
+ value: string;
+ options: readonly BrandedSelectOption[];
+ onValueChange: (value: string) => void;
+ ariaLabel: string;
+ placeholder?: string;
+ disabled?: boolean;
+ className?: string;
+ id?: string;
+ ariaDescribedBy?: string;
+ testId?: string;
+ searchPlaceholder?: string;
+ emptyLabel?: string;
+}
+
+/**
+ * The app-wide replacement for a native `<select>`.
+ *
+ * Browser and operating-system option popups cannot be styled reliably, so a
+ * native select always risks inserting foreign grey chrome into the warm dark
+ * interface. This adapter keeps short, non-searchable choices on the same
+ * accessible, portalled listbox foundation as the larger searchable pickers.
+ */
+export function BrandedSelect({
+ value,
+ options,
+ onValueChange,
+ ariaLabel,
+ placeholder,
+ disabled = false,
+ className,
+ id,
+ ariaDescribedBy,
+ testId,
+ searchPlaceholder,
+ emptyLabel,
+}: BrandedSelectProps) {
+ const groups = useMemo<ComboboxGroup[]>(
+ () => [{ id: "options", options: [...options] }],
+ [options],
+ );
+
+ return (
+ <Combobox
+ value={value}
+ groups={groups}
+ onChange={onValueChange}
+ ariaLabel={ariaLabel}
+ fallbackLabel={placeholder ?? value}
+ searchPlaceholder={searchPlaceholder}
+ emptyLabel={emptyLabel}
+ disabled={disabled}
+ className={className}
+ id={id}
+ ariaDescribedBy={ariaDescribedBy}
+ testId={testId}
+ />
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.tsx
index 81653f31d6..c70abb6fa0 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.tsx
@@ -28,6 +28,7 @@ import {
import { useQuery } from "@tanstack/react-query";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
@@ -493,8 +494,6 @@ function OptionalStep({
rerankOptions: UltraWikiProviderOption[];
}): JSX.Element {
const t = useT();
- const selectCls =
- "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/40";
return (
<div className="space-y-4">
<p className="text-sm text-muted-foreground">
@@ -504,15 +503,19 @@ function OptionalStep({
<span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
{t("ultrawiki.wizard.distill_label")}
</span>
- <select
+ <BrandedSelect
value={distill}
- onChange={(e) => onDistill(e.target.value)}
- className={selectCls}
- data-testid="ultrawiki-wizard-distill"
- >
- <option value="">{t("ultrawiki.wizard.distill_auto")}</option>
- <option value="ollama">{t("ultrawiki.wizard.distill_local")}</option>
- </select>
+ onValueChange={onDistill}
+ ariaLabel={t("ultrawiki.wizard.distill_label")}
+ testId="ultrawiki-wizard-distill"
+ options={[
+ { value: "", label: t("ultrawiki.wizard.distill_auto") },
+ {
+ value: "ollama",
+ label: t("ultrawiki.wizard.distill_local"),
+ },
+ ]}
+ />
<span className="mt-1 block text-[11px] text-muted-foreground">
{t("ultrawiki.wizard.distill_privacy_hint")}
</span>
@@ -521,26 +524,24 @@ function OptionalStep({
<span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
{t("ultrawiki.wizard.rerank_label")}
</span>
- <select
+ <BrandedSelect
value={rerank}
- onChange={(e) => onRerank(e.target.value)}
- className={selectCls}
- data-testid="ultrawiki-wizard-rerank"
- >
- <option value="">{t("ultrawiki.wizard.rerank_off")}</option>
- {rerankOptions.map((option) => (
- <option
- key={option.name}
- value={option.name}
- disabled={!option.ready}
- >
- {option.name}
- {!option.ready
- ? ` (${t("ultrawiki.slots.not_ready_suffix")})`
- : ""}
- </option>
- ))}
- </select>
+ onValueChange={onRerank}
+ ariaLabel={t("ultrawiki.wizard.rerank_label")}
+ testId="ultrawiki-wizard-rerank"
+ options={[
+ { value: "", label: t("ultrawiki.wizard.rerank_off") },
+ ...rerankOptions.map((option) => ({
+ value: option.name,
+ label: `${option.name}${
+ option.ready
+ ? ""
+ : ` (${t("ultrawiki.slots.not_ready_suffix")})`
+ }`,
+ disabled: !option.ready,
+ })),
+ ]}
+ />
</label>
</div>
);
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ContentsPanel.test.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ContentsPanel.test.tsx
index 460523366c..69e3771c39 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/ContentsPanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ContentsPanel.test.tsx
@@ -161,9 +161,14 @@ describe("ContentsPanel", () => {
expect(screen.getByTestId("ultrawiki-item-1")).toBeDefined();
});
- fireEvent.change(screen.getByTestId("ultrawiki-contents-state-filter"), {
- target: { value: "failed" },
- });
+ fireEvent.click(screen.getByTestId("ultrawiki-contents-state-filter"));
+ const panel = await screen.findByTestId(
+ "ultrawiki-contents-state-filter-panel",
+ );
+ const failed = [...panel.querySelectorAll('[role="option"]')].find(
+ (option) => option.getAttribute("data-value") === "failed",
+ );
+ fireEvent.click(failed!);
await waitFor(() => {
expect(seen.some((url) => url.includes("state=failed"))).toBe(true);
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ContentsPanel.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ContentsPanel.tsx
index 7f2bec06b8..891c4266fa 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/ContentsPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ContentsPanel.tsx
@@ -15,6 +15,7 @@ import { useCallback, useEffect, useState } from "react";
import { AlertCircle, Database, ExternalLink, Loader2 } from "lucide-react";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import { formatRelativeTime } from "@/components/ultrawiki/relativeTime";
@@ -129,35 +130,37 @@ export function ContentsPanel({
<div className="flex flex-wrap gap-2">
<label className="flex items-center gap-1.5 text-[11px] text-muted-foreground">
{t("ultrawiki.contents.filter_source")}
- <select
+ <BrandedSelect
value={sourceId}
- onChange={(e) => setSourceId(e.target.value)}
- className="rounded-lg border border-border bg-background px-2 py-1 text-xs text-foreground"
- data-testid="ultrawiki-contents-source-filter"
- >
- <option value="">{t("ultrawiki.contents.all_sources")}</option>
- {status.sources.map((source) => (
- <option key={source.id} value={source.id}>
- {source.label}
- </option>
- ))}
- </select>
+ onValueChange={setSourceId}
+ ariaLabel={t("ultrawiki.contents.filter_source")}
+ className="w-auto min-w-40 px-2 py-1 text-xs"
+ testId="ultrawiki-contents-source-filter"
+ options={[
+ { value: "", label: t("ultrawiki.contents.all_sources") },
+ ...status.sources.map((source) => ({
+ value: source.id,
+ label: source.label,
+ })),
+ ]}
+ />
</label>
<label className="flex items-center gap-1.5 text-[11px] text-muted-foreground">
{t("ultrawiki.contents.filter_state")}
- <select
+ <BrandedSelect
value={state}
- onChange={(e) => setState(e.target.value)}
- className="rounded-lg border border-border bg-background px-2 py-1 text-xs text-foreground"
- data-testid="ultrawiki-contents-state-filter"
- >
- <option value="">{t("ultrawiki.contents.all_states")}</option>
- {STATE_FILTERS.map(([key, labelKey]) => (
- <option key={key} value={key}>
- {t(labelKey)}
- </option>
- ))}
- </select>
+ onValueChange={setState}
+ ariaLabel={t("ultrawiki.contents.filter_state")}
+ className="w-auto min-w-40 px-2 py-1 text-xs"
+ testId="ultrawiki-contents-state-filter"
+ options={[
+ { value: "", label: t("ultrawiki.contents.all_states") },
+ ...STATE_FILTERS.map(([key, labelKey]) => ({
+ value: key,
+ label: t(labelKey),
+ })),
+ ]}
+ />
</label>
</div>
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/SupabaseConnect.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/SupabaseConnect.tsx
index 1f6e12418e..40318908a4 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/SupabaseConnect.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/SupabaseConnect.tsx
@@ -24,6 +24,7 @@ import { CheckCircle2, ExternalLink, Loader2, RefreshCw } from "lucide-react";
import { ApiKeyForm } from "@/components/ApiKeyForm";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
import {
@@ -143,25 +144,29 @@ export function SupabaseConnect({
<div className="flex flex-wrap items-end gap-2">
<div className="min-w-[14rem] flex-1">
<SettingsField label={t("ultrawiki.supabase.project_label")}>
- <select
+ <BrandedSelect
value={projectRef}
- onChange={(e) => setProjectRef(e.target.value)}
+ onValueChange={setProjectRef}
+ ariaLabel={t("ultrawiki.supabase.project_label")}
disabled={!projects || projects.length === 0}
className={settingsInputCls}
- data-testid="ultrawiki-supabase-project"
- >
- <option value="">
- {projects === null
- ? t("ultrawiki.supabase.load_first")
- : t("ultrawiki.supabase.choose_project")}
- </option>
- {(projects ?? []).map((project) => (
- <option key={project.ref} value={project.ref}>
- {project.name}
- {project.region ? ` · ${project.region}` : ""}
- </option>
- ))}
- </select>
+ testId="ultrawiki-supabase-project"
+ options={[
+ {
+ value: "",
+ label:
+ projects === null
+ ? t("ultrawiki.supabase.load_first")
+ : t("ultrawiki.supabase.choose_project"),
+ },
+ ...(projects ?? []).map((project) => ({
+ value: project.ref,
+ label: `${project.name}${
+ project.region ? ` · ${project.region}` : ""
+ }`,
+ })),
+ ]}
+ />
</SettingsField>
</div>
<Button
diff --git a/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.test.tsx b/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.test.tsx
index 9afc3aa49d..96684dc857 100644
--- a/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.test.tsx
@@ -394,10 +394,14 @@ describe("ObsidianSetupDialog", () => {
});
fireEvent.click(screen.getByTestId("obsidian-setup-mode-existing"));
- const select = screen.getByTestId(
- "obsidian-setup-vault-select",
- ) as HTMLSelectElement;
- fireEvent.change(select, { target: { value: VAULTS[1].path } });
+ fireEvent.click(screen.getByTestId("obsidian-setup-vault-select"));
+ const panel = await screen.findByTestId(
+ "obsidian-setup-vault-select-panel",
+ );
+ const vault = [...panel.querySelectorAll('[role="option"]')].find(
+ (option) => option.getAttribute("data-value") === VAULTS[1].path,
+ );
+ fireEvent.click(vault!);
fireEvent.click(screen.getByTestId("obsidian-setup-register"));
@@ -461,10 +465,14 @@ describe("ObsidianSetupDialog", () => {
).toBe(false);
});
fireEvent.click(screen.getByTestId("obsidian-setup-mode-existing"));
- fireEvent.change(
- screen.getByTestId("obsidian-setup-vault-select") as HTMLSelectElement,
- { target: { value: VAULTS[1].path } },
+ fireEvent.click(screen.getByTestId("obsidian-setup-vault-select"));
+ const panel = await screen.findByTestId(
+ "obsidian-setup-vault-select-panel",
+ );
+ const vault = [...panel.querySelectorAll('[role="option"]')].find(
+ (option) => option.getAttribute("data-value") === VAULTS[1].path,
);
+ fireEvent.click(vault!);
fireEvent.click(screen.getByTestId("obsidian-setup-register"));
await waitFor(() => {
diff --git a/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.tsx b/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.tsx
index 2e5817627b..f311fd370c 100644
--- a/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.tsx
+++ b/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.tsx
@@ -29,6 +29,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { Check, ExternalLink, Loader2, X } from "lucide-react";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
@@ -598,19 +599,17 @@ export function ObsidianSetupDialog({
</button>
{registerMode === "existing" && vaults.length > 0 && (
- <select
- aria-label={t("obsidian_setup_dialog.vault_select_label")}
+ <BrandedSelect
+ ariaLabel={t("obsidian_setup_dialog.vault_select_label")}
value={selectedVaultPath ?? ""}
- onChange={(e) => setSelectedVaultPath(e.target.value)}
- data-testid="obsidian-setup-vault-select"
- className="w-full rounded-md border border-input bg-background px-3 py-2 text-sm"
- >
- {vaults.map((v) => (
- <option key={v.path} value={v.path} title={v.path}>
- {v.name}
- </option>
- ))}
- </select>
+ onValueChange={setSelectedVaultPath}
+ testId="obsidian-setup-vault-select"
+ options={vaults.map((vault) => ({
+ value: vault.path,
+ label: vault.name,
+ hint: vault.path,
+ }))}
+ />
)}
</div>
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index f472977051..b151765f99 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -99,6 +99,7 @@
"contacts": "Kontakte",
"feedback": "Feedback",
"agent_instructions": "{name}.md",
+ "wallpaper": "Hintergrund",
"agentic_ide": "Agentic IDE",
"agentic_ide_beta": "Beta",
"voice": "{name} Stimme",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 4574deee1f..47e1a94b11 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -99,6 +99,7 @@
"contacts": "Contacts",
"feedback": "Feedback",
"agent_instructions": "{name}.md",
+ "wallpaper": "Wallpaper",
"agentic_ide": "Agentic IDE",
"agentic_ide_beta": "Beta",
"voice": "{name} Voice",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index cebd2785f6..0dba7c0806 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -99,6 +99,7 @@
"contacts": "Contactos",
"feedback": "Comentarios",
"agent_instructions": "{name}.md",
+ "wallpaper": "Fondo de pantalla",
"agentic_ide": "IDE agéntico",
"agentic_ide_beta": "Beta",
"voice": "Voz de {name}",
diff --git a/jarvis/ui/web/frontend/src/views/CliTestHubView.tsx b/jarvis/ui/web/frontend/src/views/CliTestHubView.tsx
index c89dfcc4fb..7f37354e1c 100644
--- a/jarvis/ui/web/frontend/src/views/CliTestHubView.tsx
+++ b/jarvis/ui/web/frontend/src/views/CliTestHubView.tsx
@@ -31,6 +31,7 @@ import {
import { ViewHeader } from "@/views/ChatsView";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
@@ -337,21 +338,24 @@ function PromptPanel({
<span className="mb-1 block text-[10px] uppercase tracking-wider text-muted-foreground/70">
{t("cli_test_hub_view.cli_hint_label")}
</span>
- <select
+ <BrandedSelect
id="cli-test-hint"
value={cliHint}
- onChange={(e) => onCliHintChange(e.target.value)}
+ onValueChange={onCliHintChange}
disabled={isPending}
- aria-label={t("cli_test_hub_view.cli_hint_aria")}
- className="min-w-[180px] rounded-md border border-input bg-background px-3 py-1.5 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-60"
- >
- <option value="">{assistantName} {t("cli_test_hub_view.let_decide")}</option>
- {connectedClis.map((cli) => (
- <option key={cli.name} value={cli.name}>
- {cli.name}
- </option>
- ))}
- </select>
+ ariaLabel={t("cli_test_hub_view.cli_hint_aria")}
+ className="min-w-[180px] py-1.5 text-xs"
+ options={[
+ {
+ value: "",
+ label: `${assistantName} ${t("cli_test_hub_view.let_decide")}`,
+ },
+ ...connectedClis.map((cli) => ({
+ value: cli.name,
+ label: cli.name,
+ })),
+ ]}
+ />
</label>
<div className="flex items-center gap-3">
diff --git a/jarvis/ui/web/frontend/src/views/ClisView.tsx b/jarvis/ui/web/frontend/src/views/ClisView.tsx
index 57efa93f85..7a6c5080a3 100644
--- a/jarvis/ui/web/frontend/src/views/ClisView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ClisView.tsx
@@ -21,6 +21,7 @@ import {
import { ViewHeader } from "@/views/ChatsView";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { cn } from "@/lib/utils";
import {
useCheckCli,
@@ -1042,16 +1043,23 @@ function CustomCliWizard({ onClose }: { onClose: () => void }) {
<div className="mb-1 text-[10px] uppercase tracking-wider text-muted-foreground/70">
{t("clis_view.auth_mode_label")}
</div>
- <select
+ <BrandedSelect
value={form.auth_mode}
- onChange={(e) => setForm({ ...form, auth_mode: e.target.value as typeof form.auth_mode })}
- className="w-full rounded-md border border-input bg-background px-3 py-1.5 text-xs"
- >
- <option value="none">{t("clis_view.auth_none")}</option>
- <option value="oauth_cli">{t("clis_view.auth_oauth_cli")}</option>
- <option value="api_key">{t("clis_view.auth_api_key")}</option>
- <option value="config_file">{t("clis_view.auth_config_file")}</option>
- </select>
+ onValueChange={(value) =>
+ setForm({
+ ...form,
+ auth_mode: value as typeof form.auth_mode,
+ })
+ }
+ ariaLabel={t("clis_view.auth_mode_label")}
+ className="py-1.5 text-xs"
+ options={[
+ { value: "none", label: t("clis_view.auth_none") },
+ { value: "oauth_cli", label: t("clis_view.auth_oauth_cli") },
+ { value: "api_key", label: t("clis_view.auth_api_key") },
+ { value: "config_file", label: t("clis_view.auth_config_file") },
+ ]}
+ />
</label>
{(form.auth_mode === "oauth_cli") && (
<TextField label={t("clis_view.field_login_command")} val={form.login_command}
@@ -1081,16 +1089,23 @@ function CustomCliWizard({ onClose }: { onClose: () => void }) {
<div className="mb-1 text-[10px] uppercase tracking-wider text-muted-foreground/70">
Risk-Tier
</div>
- <select
+ <BrandedSelect
value={form.risk_tier}
- onChange={(e) => setForm({ ...form, risk_tier: e.target.value as typeof form.risk_tier })}
- className="w-full rounded-md border border-input bg-background px-3 py-1.5 text-xs"
- >
- <option value="safe">{t("clis_view.risk_safe")}</option>
- <option value="monitor">monitor (execute + log)</option>
- <option value="ask">{t("clis_view.risk_ask")}</option>
- <option value="block">{t("clis_view.risk_block")}</option>
- </select>
+ onValueChange={(value) =>
+ setForm({
+ ...form,
+ risk_tier: value as typeof form.risk_tier,
+ })
+ }
+ ariaLabel="Risk tier"
+ className="py-1.5 text-xs"
+ options={[
+ { value: "safe", label: t("clis_view.risk_safe") },
+ { value: "monitor", label: "monitor (execute + log)" },
+ { value: "ask", label: t("clis_view.risk_ask") },
+ { value: "block", label: t("clis_view.risk_block") },
+ ]}
+ />
</label>
<TextArea label={t("clis_view.field_allow_patterns")} val={form.allow_patterns}
onChange={(v) => setForm({ ...form, allow_patterns: v })}
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
index 950a3cf61d..57dd50b9ad 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
@@ -736,6 +736,7 @@ describe("PluginsView category sections are data-driven", () => {
});
expect(screen.getByText("mystery")).toBeDefined();
// The filter menu is fed by the same data, so it offers the new category too.
+ fireEvent.click(screen.getByRole("combobox", { name: "Plugin category" }));
expect(
screen.getByRole("option", { name: "Something Brand New" }),
).toBeDefined();
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
index 075ab4f287..b84ad78aa0 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
@@ -24,6 +24,7 @@ import {
import { ViewHeader } from "@/views/ChatsView";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { cn } from "@/lib/utils";
import { openExternalUrl } from "@/lib/openExternal";
import { robustCopy } from "@/lib/clipboard";
@@ -1029,22 +1030,20 @@ function FilterMenu({ filter, setFilter }: { filter: FilterId; setFilter: (f: Fi
const { data } = useQuery({ queryKey: ["marketplace-plugins"], queryFn: fetchCatalog });
const categories = orderedCategories(data, (data?.plugins ?? []).map(adapt));
return (
- <div className="relative">
- <select
+ <div>
+ <BrandedSelect
value={filter}
- onChange={(e) => setFilter(e.target.value as FilterId)}
- className="h-9 cursor-pointer appearance-none rounded-full border border-border bg-card/60 px-4 pr-7 text-xs font-medium text-foreground hover:border-primary/40 focus:border-primary/40 focus:outline-none"
- >
- <option value="all">All</option>
- {categories.map((c) => (
- <option key={c} value={c}>
- {c}
- </option>
- ))}
- </select>
- <span className="pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-[9px] text-muted-foreground">
- ▾
- </span>
+ onValueChange={(value) => setFilter(value as FilterId)}
+ ariaLabel="Plugin category"
+ className="h-9 w-auto rounded-full bg-card/60 px-4 text-xs font-medium"
+ options={[
+ { value: "all", label: "All" },
+ ...categories.map((category) => ({
+ value: category,
+ label: category,
+ })),
+ ]}
+ />
</div>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/SelfModView.tsx b/jarvis/ui/web/frontend/src/views/SelfModView.tsx
index af82fcd764..c7f9a3f3ce 100644
--- a/jarvis/ui/web/frontend/src/views/SelfModView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SelfModView.tsx
@@ -10,6 +10,7 @@
import { useEffect, useMemo, useState } from "react";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
+import { BrandedSelect } from "@/components/ui/select";
type AuditEvent = {
ts: string;
@@ -113,20 +114,24 @@ function AuditFilters({
filter: { actor?: string; action?: string; success_only: boolean };
onChange: (f: { actor?: string; action?: string; success_only: boolean }) => void;
}) {
+ const t = useT();
return (
<div style={{ display: "flex", gap: 12, marginBottom: 12 }}>
- <select
+ <BrandedSelect
value={filter.actor ?? ""}
- onChange={(e) =>
- onChange({ ...filter, actor: e.target.value || undefined })
+ onValueChange={(value) =>
+ onChange({ ...filter, actor: value || undefined })
}
- >
- <option value="">Alle Actors</option>
- <option value="hauptjarvis">Hauptjarvis</option>
- <option value="openclaw">OpenClaw</option>
- <option value="user">User</option>
- <option value="system">System</option>
- </select>
+ ariaLabel={t("self_mod_view.all_actors")}
+ className="w-44 py-1.5 text-xs"
+ options={[
+ { value: "", label: t("self_mod_view.all_actors") },
+ { value: "hauptjarvis", label: t("self_mod_view.actor_main") },
+ { value: "openclaw", label: "OpenClaw" },
+ { value: "user", label: "User" },
+ { value: "system", label: "System" },
+ ]}
+ />
<label>
<input
type="checkbox"
@@ -135,7 +140,7 @@ function AuditFilters({
onChange({ ...filter, success_only: e.target.checked })
}
/>
- Nur erfolgreiche
+ {t("self_mod_view.successful_only")}
</label>
</div>
);
diff --git a/jarvis/ui/web/frontend/src/views/SettingsView.tsx b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
index b2d96ddd77..34895ce0f5 100644
--- a/jarvis/ui/web/frontend/src/views/SettingsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
@@ -1,16 +1,15 @@
-import { useEffect, useRef, useState } from "react";
+import { useEffect, useState } from "react";
import {
Settings,
Mic,
Keyboard,
Loader2,
Languages,
- ChevronDown,
- Check,
} from "lucide-react";
import { ViewHeader } from "@/views/ChatsView";
import { Switch } from "@/components/ui/switch";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { OverlayTaskbarGroup } from "@/views/settings/OverlayTaskbarGroup";
import { LanguagesGroup } from "@/views/settings/LanguagesGroup";
import { AppSettingsGroup } from "@/views/settings/AppSettingsGroup";
@@ -192,75 +191,19 @@ function LanguageDropdown({
onChange: (code: WakeLanguage) => void;
disabled?: boolean;
}) {
- const [open, setOpen] = useState(false);
- const ref = useRef<HTMLDivElement>(null);
- useEffect(() => {
- if (!open) return;
- const onDoc = (e: MouseEvent) => {
- if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);
- };
- const onKey = (e: KeyboardEvent) => {
- if (e.key === "Escape") setOpen(false);
- };
- document.addEventListener("mousedown", onDoc);
- document.addEventListener("keydown", onKey);
- return () => {
- document.removeEventListener("mousedown", onDoc);
- document.removeEventListener("keydown", onKey);
- };
- }, [open]);
-
- const selected = (options as string[]).includes(value)
- ? labelFor(value as WakeLanguage)
- : null;
-
return (
- <div ref={ref} className="relative">
- <button
- type="button"
- disabled={disabled}
- onClick={() => setOpen((o) => !o)}
- aria-haspopup="listbox"
- aria-expanded={open}
- className="flex w-full items-center justify-between rounded-md border border-primary/40 bg-background px-3 py-2 text-sm transition-colors hover:border-primary focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50"
- >
- <span className={selected ? "text-foreground" : "text-muted-foreground"}>
- {selected ?? placeholder}
- </span>
- <ChevronDown
- className={`h-4 w-4 shrink-0 text-primary transition-transform ${open ? "rotate-180" : ""}`}
- />
- </button>
- {open && (
- <ul
- role="listbox"
- className="absolute z-50 mt-1 w-full overflow-hidden rounded-md border border-primary/40 bg-card shadow-lg shadow-scrim/50"
- >
- {options.map((code) => {
- const active = code === value;
- return (
- <li key={code} role="option" aria-selected={active}>
- <button
- type="button"
- onClick={() => {
- onChange(code);
- setOpen(false);
- }}
- className={`flex w-full items-center justify-between px-3 py-2 text-left text-sm transition-colors ${
- active
- ? "bg-primary/15 font-medium text-primary"
- : "text-foreground hover:bg-primary/10 hover:text-primary"
- }`}
- >
- {labelFor(code)}
- {active && <Check className="h-4 w-4 shrink-0 text-primary" />}
- </button>
- </li>
- );
- })}
- </ul>
- )}
- </div>
+ <BrandedSelect
+ value={value}
+ onValueChange={(code) => onChange(code as WakeLanguage)}
+ ariaLabel={placeholder}
+ placeholder={placeholder}
+ disabled={disabled}
+ className="border-primary/40"
+ options={options.map((code) => ({
+ value: code,
+ label: labelFor(code),
+ }))}
+ />
);
}
@@ -542,18 +485,17 @@ function WakeWordPanel() {
<label className="mt-4 block text-xs font-medium text-muted-foreground">
{t("settings_view.wake_word.engine_label")}
</label>
- <select
+ <BrandedSelect
value={engine}
- onChange={(e) => setEngine(e.target.value)}
+ onValueChange={setEngine}
+ ariaLabel={t("settings_view.wake_word.engine_label")}
disabled={loading}
- className="mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50"
- >
- {WAKE_ENGINES.map((eng) => (
- <option key={eng} value={eng}>
- {t(WAKE_ENGINE_I18N_KEY[eng])}
- </option>
- ))}
- </select>
+ className="mt-1"
+ options={WAKE_ENGINES.map((wakeEngine) => ({
+ value: wakeEngine,
+ label: t(WAKE_ENGINE_I18N_KEY[wakeEngine]),
+ }))}
+ />
{/* Custom ONNX model path */}
{engine === "custom_onnx" && (
diff --git a/jarvis/ui/web/frontend/src/views/SkillsView.tsx b/jarvis/ui/web/frontend/src/views/SkillsView.tsx
index fdc130dceb..baf6979fb4 100644
--- a/jarvis/ui/web/frontend/src/views/SkillsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SkillsView.tsx
@@ -38,6 +38,7 @@ import { ScrollArea } from "@/components/ui/scroll-area";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { Switch } from "@/components/ui/switch";
+import { BrandedSelect } from "@/components/ui/select";
import { cn } from "@/lib/utils";
import { translate, useT } from "@/i18n";
import {
@@ -393,18 +394,22 @@ export function SkillsView() {
onClick={() => setOwnerFilter("builtin")}
/>
{categoryOptions.length > 0 && (
- <select
+ <BrandedSelect
value={categoryFilter ?? ""}
- onChange={(e) => setCategoryFilter(e.target.value || null)}
- className="rounded-full border border-border bg-background px-2 py-0.5 text-[10px] focus:outline-none focus:ring-1 focus:ring-primary"
- >
- <option value="">Alle Kategorien</option>
- {categoryOptions.map((c) => (
- <option key={c} value={c}>
- {c}
- </option>
- ))}
- </select>
+ onValueChange={(value) => setCategoryFilter(value || null)}
+ ariaLabel={t("skills_view.all_categories")}
+ className="w-auto rounded-full px-2 py-0.5 text-[10px]"
+ options={[
+ {
+ value: "",
+ label: t("skills_view.all_categories"),
+ },
+ ...categoryOptions.map((category) => ({
+ value: category,
+ label: category,
+ })),
+ ]}
+ />
)}
{searchActive && (
<button
@@ -412,7 +417,7 @@ export function SkillsView() {
onClick={clearFilters}
className="ml-auto text-[10px] text-muted-foreground underline hover:text-foreground"
>
- Zuruecksetzen
+ {t("skills_view.reset_filters")}
</button>
)}
</div>
diff --git a/jarvis/ui/web/frontend/src/views/contacts/ContactEditDialog.tsx b/jarvis/ui/web/frontend/src/views/contacts/ContactEditDialog.tsx
index f1069f8528..575d17be32 100644
--- a/jarvis/ui/web/frontend/src/views/contacts/ContactEditDialog.tsx
+++ b/jarvis/ui/web/frontend/src/views/contacts/ContactEditDialog.tsx
@@ -2,6 +2,7 @@ import { useState } from "react";
import { Loader2, Plus, X } from "lucide-react";
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
+import { BrandedSelect } from "@/components/ui/select";
import { RELATIONSHIPS, relationshipLabel, type Relationship } from "./constants";
import {
createContact,
@@ -126,18 +127,21 @@ export function ContactEditDialog({
</Labeled>
<Labeled label={t("contacts.relationship")}>
- <select
+ <BrandedSelect
value={relationship}
- onChange={(e) => setRelationship(e.target.value as Relationship | "")}
+ onValueChange={(value) =>
+ setRelationship(value as Relationship | "")
+ }
+ ariaLabel={t("contacts.relationship")}
className={inputClass}
- >
- <option value="">—</option>
- {RELATIONSHIPS.map((r) => (
- <option key={r} value={r}>
- {relationshipLabel(t, r)}
- </option>
- ))}
- </select>
+ options={[
+ { value: "", label: "—" },
+ ...RELATIONSHIPS.map((item) => ({
+ value: item,
+ label: relationshipLabel(t, item),
+ })),
+ ]}
+ />
</Labeled>
<ListField
diff --git a/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.test.tsx b/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.test.tsx
index 62ebf53b27..7dc0b7c290 100644
--- a/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.test.tsx
@@ -45,17 +45,14 @@ describe("AudioDevicesGroup", () => {
expect(screen.getByText("Audio devices")).toBeTruthy();
await waitFor(() => {
- const output = screen.getByTestId(
- "audio-output-select",
- ) as HTMLSelectElement;
- expect(output.value).toBe("PRO X Gaming Headset");
- const input = screen.getByTestId(
- "audio-input-select",
- ) as HTMLSelectElement;
- expect(input.value).toBe("auto-headset");
+ const output = screen.getByTestId("audio-output-select");
+ expect(output.getAttribute("data-value")).toBe("PRO X Gaming Headset");
+ const input = screen.getByTestId("audio-input-select");
+ expect(input.getAttribute("data-value")).toBe("auto-headset");
});
// The OS default entry is labeled, the automatic option is first.
+ fireEvent.click(screen.getByTestId("audio-output-select"));
expect(screen.getByText(/Speakers \(Realtek HD Audio\)/)).toBeTruthy();
const autoOptions = screen.getAllByText("Automatic (recommended)");
expect(autoOptions.length).toBe(2);
@@ -81,12 +78,11 @@ describe("AudioDevicesGroup", () => {
vi.stubGlobal("fetch", fetchMock);
render(<AudioDevicesGroup />);
- const output = (await waitFor(() =>
+ const output = await waitFor(() =>
screen.getByTestId("audio-output-select"),
- )) as HTMLSelectElement;
- fireEvent.change(output, {
- target: { value: "Speakers (Realtek HD Audio)" },
- });
+ );
+ fireEvent.click(output);
+ fireEvent.click(screen.getByText(/Speakers \(Realtek HD Audio\)/));
await waitFor(() => {
const putCall = fetchMock.mock.calls.find(
@@ -129,10 +125,8 @@ describe("AudioDevicesGroup", () => {
render(<AudioDevicesGroup />);
await waitFor(() => {
- const output = screen.getByTestId(
- "audio-output-select",
- ) as HTMLSelectElement;
- expect(output.value).toBe("Jabra Evolve2 65");
+ const output = screen.getByTestId("audio-output-select");
+ expect(output.getAttribute("data-value")).toBe("Jabra Evolve2 65");
});
});
diff --git a/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.tsx
index 043c328840..6e9ba2d016 100644
--- a/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.tsx
@@ -6,6 +6,7 @@ import {
} from "@/hooks/useAudioDevices";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
+import { BrandedSelect } from "@/components/ui/select";
/**
* "Audio devices" card inside the Settings view: one dropdown for the OUTPUT
@@ -149,21 +150,24 @@ function DevicePicker({
{icon}
{label}
</label>
- <select
- data-testid={testId}
+ <BrandedSelect
+ testId={testId}
value={selected}
- onChange={(e) => onSelect(e.target.value)}
+ onValueChange={onSelect}
+ ariaLabel={label}
disabled={disabled}
- className="mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50"
- >
- <option value={autoValue}>{autoLabel}</option>
- {devices.map((d) => (
- <option key={d.name} value={d.name}>
- {d.is_default ? `${d.name} ${defaultSuffix}` : d.name}
- </option>
- ))}
- {showOrphan && <option value={selected}>{selected}</option>}
- </select>
+ className="mt-1"
+ options={[
+ { value: autoValue, label: autoLabel },
+ ...devices.map((device) => ({
+ value: device.name,
+ label: device.is_default
+ ? `${device.name} ${defaultSuffix}`
+ : device.name,
+ })),
+ ...(showOrphan ? [{ value: selected, label: selected }] : []),
+ ]}
+ />
</>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/WikiProviderCard.test.tsx b/jarvis/ui/web/frontend/src/views/settings/WikiProviderCard.test.tsx
index 0f4f29fd58..96badeb924 100644
--- a/jarvis/ui/web/frontend/src/views/settings/WikiProviderCard.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/WikiProviderCard.test.tsx
@@ -155,7 +155,9 @@ describe("WikiProviderCard", () => {
stubFetch();
render(<WikiProviderCard />);
- await screen.findByLabelText("wiki_provider.provider_label");
+ fireEvent.click(
+ await screen.findByLabelText("wiki_provider.provider_label"),
+ );
expect(
screen.getByText("codex — wiki_provider.option_agent_suffix"),
).toBeDefined();
@@ -178,12 +180,16 @@ describe("WikiProviderCard", () => {
const fetchMock = stubFetch();
render(<WikiProviderCard />);
- const providerSelect = (await screen.findByLabelText(
+ const providerSelect = await screen.findByLabelText(
"wiki_provider.provider_label",
- )) as HTMLSelectElement;
+ );
// Picking codex mounts the shared model picker fed by codex's catalog.
- fireEvent.change(providerSelect, { target: { value: "codex" } });
+ fireEvent.click(providerSelect);
+ const codexOption = (await screen.findAllByRole("option")).find(
+ (option) => option.getAttribute("data-value") === "codex",
+ );
+ fireEvent.click(codexOption!);
const trigger = await screen.findByLabelText("apikeys_model.model_label");
fireEvent.click(trigger);
@@ -206,11 +212,15 @@ describe("WikiProviderCard", () => {
const fetchMock = stubFetch();
render(<WikiProviderCard />);
- const providerSelect = (await screen.findByLabelText(
+ const providerSelect = await screen.findByLabelText(
"wiki_provider.provider_label",
- )) as HTMLSelectElement;
+ );
- fireEvent.change(providerSelect, { target: { value: "gemini" } });
+ fireEvent.click(providerSelect);
+ const geminiOption = (await screen.findAllByRole("option")).find(
+ (option) => option.getAttribute("data-value") === "gemini",
+ );
+ fireEvent.click(geminiOption!);
fireEvent.click(screen.getByRole("button", { name: "wiki_provider.apply" }));
await waitFor(() => {
diff --git a/jarvis/ui/web/frontend/src/views/settings/WikiProviderCard.tsx b/jarvis/ui/web/frontend/src/views/settings/WikiProviderCard.tsx
index c39bccb468..57a53940f4 100644
--- a/jarvis/ui/web/frontend/src/views/settings/WikiProviderCard.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/WikiProviderCard.tsx
@@ -1,6 +1,7 @@
import { useState } from "react";
import { BookOpen, ChevronDown, Info, Loader2 } from "lucide-react";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import { cn } from "@/lib/utils";
import { BrainModelSelector } from "@/components/BrainModelSelector";
import type { BrainModelSaveResult } from "@/hooks/useProviders";
@@ -19,7 +20,7 @@ const FOLLOW_PRIMARY = "";
* dedicated Wiki-curator provider + (optional) model via
* `GET/PUT /api/settings/wiki-provider`.
*
- * The provider `<select>` is fed by the endpoint's `available` matrix (agent
+ * The provider picker is fed by the endpoint's `available` matrix (agent
* providers such as Codex are labelled, keyless ones flagged). The model pick
* uses the shared searchable {@link BrainModelSelector} against the chosen
* provider's live catalog (`GET /api/providers/{id}/models`) — the same picker
@@ -153,21 +154,24 @@ export function WikiProviderCard() {
<div className="grid gap-4 sm:grid-cols-2">
<SettingsField label={t("wiki_provider.provider_label")}>
- <select
- aria-label={t("wiki_provider.provider_label")}
+ <BrandedSelect
+ ariaLabel={t("wiki_provider.provider_label")}
value={providerValue}
- onChange={(e) => handleProviderChange(e.target.value)}
+ onValueChange={handleProviderChange}
className={settingsInputCls}
- >
- <option value={FOLLOW_PRIMARY}>{t("wiki_provider.follow_primary")}</option>
- {data.available
- .filter((p) => p.provider !== FOLLOW_PRIMARY)
- .map((p) => (
- <option key={p.provider} value={p.provider}>
- {providerOptionLabel(p)}
- </option>
- ))}
- </select>
+ options={[
+ {
+ value: FOLLOW_PRIMARY,
+ label: t("wiki_provider.follow_primary"),
+ },
+ ...data.available
+ .filter((item) => item.provider !== FOLLOW_PRIMARY)
+ .map((item) => ({
+ value: item.provider,
+ label: providerOptionLabel(item),
+ })),
+ ]}
+ />
</SettingsField>
{providerValue === FOLLOW_PRIMARY ? (