Skip to content

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

feat(ui): brand every dropdown

rubenluetke10-beepd383779e461f
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/controls.tsx b/jarvis/ui/web/frontend/src/components/agentic/controls.tsx
index bc94a67074..b6cf386f9e 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/controls.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/controls.tsx
@@ -136,34 +136,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/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 93141eb73c..1824732f85 100644
--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx
@@ -1087,10 +1087,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 4725cd460a..af2d2d6c81 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,
@@ -2327,21 +2328,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">
@@ -2349,29 +2355,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.tsx b/jarvis/ui/web/frontend/src/components/ui/combobox.tsx
index 7cd14ebf1e..031deb5b7f 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;
}
@@ -113,6 +117,8 @@ export function Combobox({
matches = defaultMatches,
disabled = false,
className,
+ id,
+ ariaDescribedBy,
testId,
}: ComboboxProps) {
const [open, setOpen] = useState(false);
@@ -163,6 +169,10 @@ export function Combobox({
() => visibleGroups.flatMap((group) => group.options),
[visibleGroups],
);
+ const enabled = useMemo(
+ () => flat.filter((option) => !option.disabled),
+ [flat],
+ );
const measure = useCallback(() => {
const trigger = triggerRef.current;
@@ -234,7 +244,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 +285,7 @@ export function Combobox({
}, [open, close]);
function commit(option: ComboboxOption) {
+ if (option.disabled) return;
close();
if (option.value !== value) onChange(option.value);
}
@@ -291,19 +302,23 @@ 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];
+ const option = enabled[activeIndex];
if (option) commit(option);
}
}
@@ -316,27 +331,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 +388,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">
@@ -428,19 +446,24 @@ export function Combobox({
id={`${listId}-${option.value}`}
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.indexOf(option));
+ }
+ }}
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/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 9c1730f942..16527bb577 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
@@ -486,6 +486,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 854ca96555..e89fdd6068 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
@@ -19,6 +19,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";
@@ -901,22 +902,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 ? (