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
feat(keybinds): a shortcut saves itself — no Save button
Ruben Lütkec8dbf16012a0
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex e08e41631e..04b2711297 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1500,9 +1500,9 @@"record": "Aufnehmen","stop": "Stopp","recording": "Drücke deine Tasten…",- "recording_hint": "Halte die gewünschten Tasten (dann loslassen) — oder klick sie unten auf der Tastatur an. Esc bricht ab.",+ "recording_hint": "Halte die gewünschten Tasten (dann loslassen) — oder klick sie unten auf der Tastatur an. Wird automatisch gespeichert. Esc bricht ab.","record_prompt": "Drücke deine Kombination…",- "record_prompt_hint": "Jede Kombination geht — Strg, Alt, Umschalt, die Windows- oder Command-Taste und die mittlere oder seitliche Maustaste. Halte die gewünschten Tasten, dann loslassen. Esc bricht ab.",+ "record_prompt_hint": "Jede Kombination geht — Strg, Alt, Umschalt, die Windows- oder Command-Taste und die mittlere oder seitliche Maustaste. Halte die gewünschten Tasten, dann loslassen — wird automatisch gespeichert. Esc bricht ab.","caution_modifier_only": "Nur Modifikatortasten: Das löst auch aus, wenn du gleichzeitig etwas anderes drückst — Strg+Windows greift also auch bei Strg+Windows+Links.","caution_os_shortcut": "Nichts wird abgefangen: Was diese Kombination ohnehin schon tut — ein System-Kürzel oder ein Klick auf das, worauf du zeigst — passiert weiterhin, du bekommst also beides gleichzeitig.","unbound": "Keine Taste zugewiesen",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 9994c8d9a4..dec8636edc 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1501,9 +1501,9 @@"record": "Record","stop": "Stop","recording": "Press your keys…",- "recording_hint": "Hold the keys you want (then let go), or click them on the keyboard below. Esc cancels.",+ "recording_hint": "Hold the keys you want (then let go), or click them on the keyboard below. It saves itself. Esc cancels.","record_prompt": "Press your combination…",- "record_prompt_hint": "Any combination works — Ctrl, Alt, Shift, the Windows or Command key, and the middle or side buttons of your mouse. Hold the keys you want, then let go. Esc cancels.",+ "record_prompt_hint": "Any combination works — Ctrl, Alt, Shift, the Windows or Command key, and the middle or side buttons of your mouse. Hold the keys you want, then let go — it saves itself. Esc cancels.","caution_modifier_only": "Modifier keys only: this also fires whenever you press something else together with them, so Ctrl+Win triggers on Ctrl+Win+Left too.","caution_os_shortcut": "Nothing is swallowed: whatever this combination already does — a system shortcut, or a click on whatever you are pointing at — still happens, so you get both at once.","unbound": "No key assigned",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 140fd9fe45..92dacc983a 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1500,9 +1500,9 @@"record": "Grabar","stop": "Detener","recording": "Presiona tus teclas…",- "recording_hint": "Mantén las teclas que quieras (y suéltalas) — o haz clic en ellas en el teclado de abajo. Esc cancela.",+ "recording_hint": "Mantén las teclas que quieras (y suéltalas) — o haz clic en ellas en el teclado de abajo. Se guarda solo. Esc cancela.","record_prompt": "Pulsa tu combinación…",- "record_prompt_hint": "Vale cualquier combinación — Ctrl, Alt, Mayús, la tecla Windows o Command, y el botón central o lateral del ratón. Mantén las teclas que quieras y suéltalas. Esc cancela.",+ "record_prompt_hint": "Vale cualquier combinación — Ctrl, Alt, Mayús, la tecla Windows o Command, y el botón central o lateral del ratón. Mantén las teclas que quieras y suéltalas: se guarda solo. Esc cancela.","caution_modifier_only": "Solo teclas modificadoras: también se dispara cuando pulsas otra cosa a la vez, así que Ctrl+Windows se activa también con Ctrl+Windows+Izquierda.","caution_os_shortcut": "No se intercepta nada: lo que esta combinación ya hace — un atajo del sistema o un clic sobre lo que estés señalando — sigue ocurriendo, así que pasan las dos cosas a la vez.","unbound": "Sin tecla asignada",diff --git a/jarvis/ui/web/frontend/src/views/KeybindsPanel.test.tsx b/jarvis/ui/web/frontend/src/views/KeybindsPanel.test.tsxindex 528cde0ecc..bf5d642b65 100644--- a/jarvis/ui/web/frontend/src/views/KeybindsPanel.test.tsx+++ b/jarvis/ui/web/frontend/src/views/KeybindsPanel.test.tsx@@ -29,11 +29,28 @@ const FULL = {afterEach(() => vi.restoreAllMocks());-function stubFetch() {+/** One recorded request, so a test can assert what actually went out. */+interface RecordedCall {+ url: string;+ method: string;+ body?: unknown;+}++/** Stub the API and return the list the calls land in (empty until they do). */+function stubFetch(): RecordedCall[] {+ const calls: RecordedCall[] = [];vi.stubGlobal("fetch",- vi.fn().mockResolvedValue({ ok: true, json: async () => FULL }),+ vi.fn(async (url: unknown, init?: { method?: string; body?: unknown }) => {+ calls.push({+ url: String(url),+ method: init?.method ?? "GET",+ body: init?.body ? JSON.parse(String(init.body)) : undefined,+ });+ return { ok: true, json: async () => FULL };+ }),);+ return calls;}/** The combo field's visible text with whitespace collapsed ("F3+F4") —@@ -202,8 +219,48 @@ describe("KeybindsPanel", () => {await waitFor(() => expect(comboText("call")).toBe("I+Y"));});- it("keeps Save enabled on a live overlap and explains it instead", async () => {- stubFetch();+ it("saves a recorded chord the moment the keys are released", async () => {+ // The reported annoyance: "I have to press a Save button first." A combo+ // is not a form field — letting go of the keys IS the decision, so there+ // is nothing left for a button to confirm.+ const calls = stubFetch();+ render(<KeybindsPanel />);++ await waitFor(() => expect(comboText("call")).toBe("F3+F4"));+ fireEvent.click(screen.getByTestId("combo-field-call"));++ fireEvent.keyDown(window, { code: "F7", key: "F7" });+ fireEvent.keyDown(window, { code: "F8", key: "F8" });+ fireEvent.keyUp(window, { code: "F8", key: "F8" });+ fireEvent.keyUp(window, { code: "F7", key: "F7" });++ await waitFor(() => {+ const put = calls.find((c) => c.method === "PUT");+ expect(put?.url).toBe("/api/settings/keybinds");+ expect(put?.body).toMatchObject({ action: "call", hotkey: "f7+f8" });+ });+ // No settle delay on a physical chord — nothing follows a full release.+ expect(calls.filter((c) => c.method === "PUT")).toHaveLength(1);+ });++ it("does not save anything when Esc cancels the recording", async () => {+ const calls = stubFetch();+ render(<KeybindsPanel />);++ await waitFor(() => expect(comboText("call")).toBe("F3+F4"));+ fireEvent.click(screen.getByTestId("combo-field-call"));+ fireEvent.keyDown(window, { code: "F7", key: "F7" });+ fireEvent.keyDown(window, { code: "Escape", key: "Escape" });++ await waitFor(() => expect(comboText("call")).toBe("F3+F4"));+ // Auto-save refuses anything the server already has, which is what makes+ // Esc, the initial load and a refetch safe without any of them knowing.+ await new Promise((r) => setTimeout(r, 1500));+ expect(calls.some((c) => c.method === "PUT")).toBe(false);+ });++ it("still saves on a live overlap and explains it instead", async () => {+ const calls = stubFetch();render(<KeybindsPanel />);const recordButtons = await waitFor(() =>@@ -223,12 +280,19 @@ describe("KeybindsPanel", () => {screen.getByTestId("keybind-validation-call"),);expect(line.textContent).toBeTruthy();- const saveButtons = screen.getAllByRole("button", { name: /save/i });- expect((saveButtons[0] as HTMLButtonElement).disabled).toBe(false);+ await waitFor(+ () =>+ expect(+ calls.some(+ (c) => c.method === "PUT" && (c.body as { hotkey: string }).hotkey === "f1",+ ),+ ).toBe(true),+ { timeout: 4000 },+ );});it("saves a modifier-only combo (Ctrl+Win) and cautions instead of blocking", async () => {- stubFetch();+ const calls = stubFetch();render(<KeybindsPanel />);const recordButtons = await waitFor(() =>@@ -254,8 +318,17 @@ describe("KeybindsPanel", () => {// prefix behaviour is a sentence, not a wall.expect(comboText("call")).toBe("Ctrl+Win");expect(screen.getByTestId("keybind-validation-call")).toBeTruthy();- const saveButtons = screen.getAllByRole("button", { name: /save/i });- expect((saveButtons[0] as HTMLButtonElement).disabled).toBe(false);+ await waitFor(+ () =>+ expect(+ calls.some(+ (c) =>+ c.method === "PUT" &&+ (c.body as { hotkey: string }).hotkey === "ctrl+win",+ ),+ ).toBe(true),+ { timeout: 4000 },+ );});it("records Ctrl+Win from a physical chord (the gesture used to vanish)", async () => {@@ -386,21 +459,27 @@ describe("KeybindsPanel", () => {.toBeTruthy();});- it("closes the recorder after a successful save (no stale-snapshot Esc)", async () => {- stubFetch();+ it("click-to-assign saves once the clicking settles, then closes", async () => {+ const calls = stubFetch();render(<KeybindsPanel />);await waitFor(() => expect(comboText("call")).toBe("F3+F4"));fireEvent.click(screen.getByTestId("combo-field-call"));expect(screen.getByTestId("key-F5")).toBeTruthy(); // keyboard open- // Build the combo by CLICKING (no physical keys → no auto-commit timer):- // F3 off, F4 off, F5 on. The recorder stays open during click-to-assign.+ // Build the combo by CLICKING: F3 off, F4 off, F5 on. Each click is+ // probably not the last, so nothing is sent while they are still coming —+ // otherwise the half-built combo ("F4" alone here) would be saved first.fireEvent.click(screen.getByTestId("key-F3"));fireEvent.click(screen.getByTestId("key-F4"));fireEvent.click(screen.getByTestId("key-F5"));- const saveButtons = screen.getAllByRole("button", { name: /save/i });- fireEvent.click(saveButtons[0]);++ await waitFor(+ () => expect(calls.filter((c) => c.method === "PUT")).toHaveLength(1),+ { timeout: 4000 },+ );+ expect((calls.find((c) => c.method === "PUT")!.body as { hotkey: string }).hotkey)+ .toBe("f5");// The save finishes the recording session — leaving it open kept a stale// pre-recording snapshot that a later Esc would "restore", silently@@ -424,8 +503,8 @@ describe("KeybindsPanel", () => {await waitFor(() => expect(comboText("call")).toBe("F3+F4"));});- it("allows a solo navigation key with a warning, Save stays enabled", async () => {- stubFetch();+ it("allows a solo navigation key with a warning and saves it anyway", async () => {+ const calls = stubFetch();render(<KeybindsPanel />);const recordButtons = await waitFor(() =>@@ -440,7 +519,14 @@ describe("KeybindsPanel", () => {// A warning line appears (fires during text navigation) but the combo is// legal — the user asked for Arrow Up, the user gets Arrow Up.expect(screen.getByTestId("keybind-validation-call")).toBeTruthy();- const saveButtons = screen.getAllByRole("button", { name: /save/i });- expect((saveButtons[0] as HTMLButtonElement).disabled).toBe(false);+ await waitFor(+ () =>+ expect(+ calls.some(+ (c) => c.method === "PUT" && (c.body as { hotkey: string }).hotkey === "up",+ ),+ ).toBe(true),+ { timeout: 4000 },+ );});});diff --git a/jarvis/ui/web/frontend/src/views/settings/KeybindRow.tsx b/jarvis/ui/web/frontend/src/views/settings/KeybindRow.tsxindex fd4dc2cfee..85462a44c7 100644--- a/jarvis/ui/web/frontend/src/views/settings/KeybindRow.tsx+++ b/jarvis/ui/web/frontend/src/views/settings/KeybindRow.tsx@@ -26,6 +26,16 @@ import { useT } from "@/i18n";// The keyboard family (Mac vs PC modifier labels) is fixed for the session.const _KB_PLATFORM = detectKeyboardPlatform();+/**+ * How long click-to-assign waits after the last click before saving.+ *+ * Long enough to click "Ctrl", "Shift", "F5" at a human pace without saving+ * the first two on their own; short enough that the save still feels part of+ * the same gesture. A physical chord does not use this — letting go of the+ * keys is already an unambiguous "I am done".+ */+const _CLICK_SETTLE_MS = 1200;+/** Pretty-print a combo string ("ctrl+right_alt+j" → "Ctrl + AltGr + J"). */export function formatCombo(combo: string): string {const labels: Record<string, string> = {@@ -262,12 +272,14 @@ export function KeybindRow({// Live validation — every backend rule surfaces HERE, while the user builds// the combo, instead of as a cryptic post-Save error toast (the reported- // "I picked Arrow Up and got a weird error message" experience).+ // "I picked Arrow Up and got a weird error message" experience). With the+ // Save button gone this line IS the feedback: a collision is what stops the+ // auto-save, so it has to explain itself on screen and not merely disable+ // something.const validation = useMemo(() => validateCombo(combo, otherCombos),[combo, otherCombos],);- const invalid = validation.status === "error";const validationMsg = validationText(validation, t);// Click-to-assign: toggle a key in/out of the combo without a physical press.@@ -281,6 +293,10 @@ export function KeybindRow({return composeCombo(tokens);});setSaved(false);+ // Clicks arrive one at a time while a combo is being built, so this one is+ // probably not the last — wait for the clicking to stop before saving.+ editVia.current = "click";+ setEdits((n) => n + 1);}// While capturing, listen on `window` (capture phase) instead of on a single@@ -312,6 +328,69 @@ export function KeybindRow({currentRef.current = current;const comboBeforeCapture = useRef(combo);+ // ------------------------------------------------------------------+ // Auto-save+ // ------------------------------------------------------------------+ // The combo IS the setting. A separate Save button could only add a step the+ // user has to remember — and forgetting it looks exactly like the shortcut+ // being broken, which is the one failure this surface must never produce.+ //+ // ``edits`` counts USER edits (a bumped counter, not the combo string, so+ // toggling a key off and back on still re-arms the timer). ``editVia`` says+ // how the edit arrived, which decides the delay: a physical chord and a+ // suggestion chip are complete gestures and save at once, while a click on+ // the on-screen keyboard is probably one of several and waits for the+ // clicking to settle — otherwise the half-built combo would be saved, and+ // the user's second click would be a second save.+ //+ // Nothing here needs to know about Esc, the initial config load, or a+ // refetch: ``persist`` refuses anything equal to what the server already+ // has, which covers all three by construction.+ const [edits, setEdits] = useState(0);+ const editVia = useRef<"chord" | "click">("chord");+ const savingRef = useRef(false);++ // Held in a ref so the timer effect below depends on the EDIT, not on the+ // identity of this function (which changes on every render).+ const persistRef = useRef<(next: string) => Promise<void>>(async () => {});+ persistRef.current = async (next: string) => {+ const trimmed = next.trim().toLowerCase();+ // Empty is not an auto-save: clearing a shortcut is what the X button is+ // for, and a combo being rebuilt from nothing passes through empty.+ if (!trimmed || trimmed === current) return;+ // A collision is the one thing the backend refuses (400). The inline+ // message already says so; firing a doomed request would only add a toast.+ if (validateCombo(trimmed, otherCombos).status === "error") return;+ if (savingRef.current) return;+ savingRef.current = true;+ setSaving(true);+ try {+ const res = await onSave(action, trimmed);+ setSaved(res.restart_required);+ // The gesture is over — leaving the recorder open would keep a stale+ // pre-recording snapshot that a later Esc would "restore".+ setCapturing(false);+ pushToast("success", t("settings_view.keybinds.saved"));+ await onSaved?.(trimmed);+ } catch (e) {+ // Rejected (collision the live check could not see, an unusable mouse+ // button on this host, …). Show the backend's own reason.+ pushToast("error", (e as Error).message);+ } finally {+ savingRef.current = false;+ setSaving(false);+ }+ };++ useEffect(() => {+ if (edits === 0) return;+ const delay = editVia.current === "click" ? _CLICK_SETTLE_MS : 0;+ const timer = setTimeout(() => {+ void persistRef.current(combo);+ }, delay);+ return () => clearTimeout(timer);+ }, [edits, combo]);+useEffect(() => {if (!capturing) return;comboBeforeCapture.current = combo; // fallback when nothing is saved yet@@ -326,6 +405,10 @@ export function KeybindRow({setCombo(pending);setSaved(false);setCapturing(false);+ // Letting go of the keys ends the gesture, so this saves immediately —+ // no settle delay, nothing left to press.+ editVia.current = "chord";+ setEdits((n) => n + 1);}}@@ -455,31 +538,17 @@ export function KeybindRow({if (!capturing) setPressedCodes(new Set());}, [capturing]);- async function onSaveClick() {- const trimmed = combo.trim().toLowerCase();- if (!trimmed) return;- setSaving(true);+ /** Set the combo from a one-shot control (chip / reset) and save it now. */+ function assign(next: string) {+ setCombo(next);setSaved(false);- try {- const res = await onSave(action, trimmed);- setSaved(res.restart_required);- // The save concludes the recording session. Leaving the recorder open- // kept a stale pre-recording snapshot around that a later Esc would- // "restore" — silently diverging the field from the saved value.- setCapturing(false);- pushToast("success", t("settings_view.keybinds.saved"));- await onSaved?.(trimmed);- } catch (e) {- // Backend rejected the combo (unsafe / collision) — show its reason.- pushToast("error", (e as Error).message);- } finally {- setSaving(false);- }+ editVia.current = "chord"; // a single deliberate click — nothing follows it+ setEdits((n) => n + 1);}- // Immediate, one-click unbind — no staging step, mirroring the "Reset to- // default" link's immediacy. Bypasses onSaveClick's trimmed-empty guard,- // which exists to stop an in-progress recording from saving nothing.+ // Immediate, one-click unbind. Its own path rather than an auto-save,+ // because auto-save deliberately refuses an EMPTY combo: one being rebuilt+ // from scratch passes through empty, and that must never unbind the row.async function onClearClick() {setSaving(true);try {@@ -495,7 +564,6 @@ export function KeybindRow({}}- const dirty = !!config && combo.trim().toLowerCase() !== current;const showReset = !!def && combo.trim().toLowerCase() !== def;// Curated combos that are still free — a chip proposing a combo another@@ -651,10 +719,7 @@ export function KeybindRow({key={s}type="button"data-testid={`suggestion-${action}-${s}`}- onClick={() => {- setCombo(s);- setSaved(false);- }}+ onClick={() => assign(s)}className="rounded-full border border-border bg-background px-2 py-0.5 font-mono text-[11px] text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground">{formatCombo(s)}@@ -665,33 +730,19 @@ export function KeybindRow({{statusLine}- {/* The commit controls only appear once there is something to commit —- a resting row is just the shortcut, not a form. */}- {(dirty || showReset) && (+ {/* No Save button: the combo IS the setting and saves itself. What is+ left is the one control that changes it to something else. */}+ {showReset && (<div className="mt-3 flex flex-wrap items-center gap-2">- <Button- size="sm"- onClick={onSaveClick}- disabled={saving || loading || !dirty || invalid}+ <button+ type="button"+ className="text-[11px] text-muted-foreground underline hover:text-foreground"+ onClick={() => {+ if (def) assign(def);+ }}>- {saving- ? t("settings_view.saving")- : t("settings_view.keybinds.save")}- </Button>- {showReset && (- <button- type="button"- className="text-[11px] text-muted-foreground underline hover:text-foreground"- onClick={() => {- if (def) {- setCombo(def);- setSaved(false);- }- }}- >- {t("settings_view.keybinds.reset")}- </button>- )}+ {t("settings_view.keybinds.reset")}+ </button></div>)}@@ -710,10 +761,7 @@ export function KeybindRow({type="button"className="text-[11px] text-muted-foreground underline hover:text-foreground"onClick={() => {- if (def) {- setCombo(def);- setSaved(false);- }+ if (def) assign(def);}}>{t("settings_view.keybinds.reset")}@@ -732,13 +780,6 @@ export function KeybindRow({? t("settings_view.keybinds.stop"): t("settings_view.keybinds.record")}</Button>- <Button- size="sm"- onClick={onSaveClick}- disabled={saving || loading || !dirty || invalid}- >- {saving ? t("settings_view.saving") : t("settings_view.keybinds.save")}- </Button><Buttontype="button"size="sm"diff --git a/jarvis/ui/web/frontend/src/views/voice/ShortcutsTab.test.tsx b/jarvis/ui/web/frontend/src/views/voice/ShortcutsTab.test.tsxindex f1c6a1ff67..1f69e6d722 100644--- a/jarvis/ui/web/frontend/src/views/voice/ShortcutsTab.test.tsx+++ b/jarvis/ui/web/frontend/src/views/voice/ShortcutsTab.test.tsx@@ -1,4 +1,11 @@-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import {+ act,+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from "@testing-library/react";import { afterEach, describe, expect, it, vi } from "vitest";// ViewHeader lives in ChatsView, which drags in the whole chat surface. The tab@@ -167,15 +174,14 @@ describe("ShortcutsTab", () => {expect(screen.queryByTestId("view-header")).toBeNull();});- it("saving push-to-talk also pins the dictation mode to hold", async () => {+ it("picking push-to-talk saves it and pins the dictation mode to hold", async () => {const calls = stubFetch();render(<ShortcutsTab />);await waitFor(() => expect(comboText("dictate")).toBe("Ctrl+AltGr+J"));- // A suggested combo is one click away; Save appears once the row is dirty.+ // One click on a suggested combo IS the change — there is no Save step.fireEvent.click(screen.getByTestId("suggestion-dictate-ctrl+shift+space"));await waitFor(() => expect(comboText("dictate")).toBe("Ctrl+Shift+Space"));- fireEvent.click(screen.getAllByRole("button", { name: /^save$/i })[0]);await waitFor(() =>expect(@@ -210,7 +216,6 @@ describe("ShortcutsTab", () => {screen.getByTestId("suggestion-dictate_toggle-ctrl+shift+d"),);await waitFor(() => expect(comboText("dictate_toggle")).toBe("Ctrl+Shift+D"));- fireEvent.click(screen.getAllByRole("button", { name: /^save$/i })[0]);await waitFor(() =>expect(calls.some((c) => c.method === "PUT")).toBe(true),@@ -236,28 +241,37 @@ describe("ShortcutsTab", () => {);});- it("blocks an overlapping combo before it can be saved", async () => {- stubFetch();- render(<ShortcutsTab />);- await waitFor(() => expect(comboText("dictate")).toBe("Ctrl+AltGr+J"));-- // Build hangup's exact combo on the push-to-talk row: F1+F2.- fireEvent.click(screen.getByTestId("record-keybind-dictate"));- fireEvent.click(screen.getByTestId("key-ControlLeft"));- fireEvent.click(screen.getByTestId("key-AltRight"));- fireEvent.click(screen.getByTestId("key-KeyJ"));- fireEvent.click(screen.getByTestId("key-F1"));- fireEvent.click(screen.getByTestId("key-F2"));-- const line = await waitFor(() =>- screen.getByTestId("keybind-validation-dictate"),- );- // The collision names the other action the way the UI labels it, not by- // its raw id.- expect(line.textContent).toMatch(/hangup/i);- const save = screen.getAllByRole("button", {- name: /^save$/i,- })[0] as HTMLButtonElement;- expect(save.disabled).toBe(true);+ it("never auto-saves an overlapping combo, and says why", async () => {+ vi.useFakeTimers();+ try {+ const calls = stubFetch();+ render(<ShortcutsTab />);+ await vi.waitFor(() => expect(comboText("dictate")).toBe("Ctrl+AltGr+J"));++ // Build hangup's exact combo on the push-to-talk row: F1+F2.+ fireEvent.click(screen.getByTestId("record-keybind-dictate"));+ fireEvent.click(screen.getByTestId("key-ControlLeft"));+ fireEvent.click(screen.getByTestId("key-AltRight"));+ fireEvent.click(screen.getByTestId("key-KeyJ"));+ fireEvent.click(screen.getByTestId("key-F1"));+ fireEvent.click(screen.getByTestId("key-F2"));++ const line = await vi.waitFor(() =>+ screen.getByTestId("keybind-validation-dictate"),+ );+ // The collision names the other action the way the UI labels it, not by+ // its raw id.+ expect(line.textContent).toMatch(/hangup/i);++ // With no Save button to disable, THIS is what "blocked" means now: the+ // settle timer fires and the request is never sent. The inline sentence+ // above is the only feedback there is, which is why it has to be there.+ await act(async () => {+ vi.advanceTimersByTime(5_000);+ });+ expect(calls.some((c) => c.method === "PUT")).toBe(false);+ } finally {+ vi.useRealTimers();+ }});});