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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(society): keep agent card open when dismissing model menu
rubenluetke10-beep9b40e236b04f
diff --git a/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.test.tsx b/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.test.tsxindex 3e0058cee0..0d74920498 100644--- a/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.test.tsx+++ b/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.test.tsx@@ -1,4 +1,5 @@import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import * as Dialog from "@radix-ui/react-dialog";import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";import { afterEach, beforeEach, expect, test, vi } from "vitest";import { loadLocaleChunk } from "@/i18n";@@ -52,7 +53,7 @@ beforeEach(async () => {});afterEach(() => { cleanup(); vi.unstubAllGlobals(); });-function mount(busy = false) {+function mount(busy = false, inDialog = false) {const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });const initial: SocietyAgent = { ...SAMPLE_ROSTER[1], ...rowToAgent(row) };client.setQueryData(["society", "roster"], { agents: [initial], sample: false });@@ -60,7 +61,9 @@ function mount(busy = false) {const { agent } = useSocietyAgent("scout");return <AgentModelPicker agent={agent ?? initial} busy={busy} onSavingChange={saving} />;}- return render(<QueryClientProvider client={client}><Subject /></QueryClientProvider>);+ return render(<QueryClientProvider client={client}>{inDialog ? <Dialog.Root defaultOpen>+ <Dialog.Content><Dialog.Title>Agent</Dialog.Title><Dialog.Description>Model controls</Dialog.Description><Subject /></Dialog.Content>+ </Dialog.Root> : <Subject />}</QueryClientProvider>);}async function open() {@@ -180,3 +183,11 @@ test("keyboard navigation moves through results and closes back to the trigger",fireEvent.keyDown(document.activeElement!, { key: "Escape" });expect(document.activeElement).toBe(screen.getByRole("button", { name: "Model" }));});++test("Escape closes a nested menu before the surrounding agent card", async () => {+ mount(false, true); const input = await open();+ fireEvent.keyDown(input, { key: "Escape" });+ expect(screen.queryByRole("menu")).toBeNull();+ expect(screen.getByRole("dialog")).toBeTruthy();+ expect(document.activeElement).toBe(screen.getByRole("button", { name: "Model" }));+});diff --git a/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.tsx b/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.tsxindex 17c2239d98..c75f41d335 100644--- a/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.tsx+++ b/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.tsx@@ -67,6 +67,18 @@ export function AgentModelPicker({ agent, busy, onSavingChange }: {setOpen(false); setSubmenu(null); trigger.current?.focus();}+ useEffect(() => {+ if (!open) return;+ // Radix listens on document capture: the nested menu must handle Escape first.+ const escape = (event: globalThis.KeyboardEvent) => {+ if (event.key !== "Escape") return;+ event.preventDefault(); event.stopPropagation();+ if (submenu) { setSubmenu(null); input.current?.focus(); } else close();+ };+ window.addEventListener("keydown", escape, true);+ return () => window.removeEventListener("keydown", escape, true);+ }, [open, submenu]);+useLayoutEffect(() => {if (!open) return;let frame = 0;