commit a9279d1ec45f75205d960169d430a5437b6c354a
parent 4d19761b577e4926b47961257da9ffcac48b0d01
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 10 Nov 2026 15:56:22 -0500
umtool: under a modal (the ⌘K palette, the Keys) the review pass's k f n and present mode's keys stand aside wherever the focus is -- Esc closes the palette, never present mode under it (components/ui/modalOpen.ts) -- L7b review item 3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat:
5 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/umtool/components/projects/present/PresentView.tsx b/umtool/components/projects/present/PresentView.tsx
@@ -6,6 +6,7 @@ import PostItemPlayer, { postItemAssets, type CardView, type PostPlan, type Prog
import ComboBadge, { type ComboInfo } from "../review/ComboBadge";
import { postPreload } from "../review/playEngine/postPreload";
import IntroCardPlayer, { type IntroPage } from "../review/IntroCardPlayer";
+import { aModalIsOpen } from "@/components/ui/modalOpen";
// ---------------------------------------------------------------------------
// PRESENT MODE, THE VIEWER (umtool/docs/knobs.md, "Present mode"; operator, 8 Nov 2026): the cut as slides, one at
@@ -243,6 +244,8 @@ export default function PresentView({
// ---- the keys ----
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
+ // A modal is up (the ⌘K palette): its keys -- Esc closes IT, never present mode under it; no slide moves.
+ if (aModalIsOpen()) return;
const t = e.target as HTMLElement | null;
// Typing in a field (the linger) is not a move; a checkbox is not typing.
const typing = !!t && ((t.tagName === "INPUT" && !["checkbox", "radio", "button"].includes((t as HTMLInputElement).type)) || t.tagName === "TEXTAREA" || t.isContentEditable);
diff --git a/umtool/components/projects/workspace/ReviewPass.tsx b/umtool/components/projects/workspace/ReviewPass.tsx
@@ -13,6 +13,7 @@ import { announceManifestChanged } from "../timelineApi";
import VersionVerdict from "../review/VersionVerdict";
import type { PlayEntry } from "../review/PlayCut";
import { READ_ONLY_SAID } from "./readOnly";
+import { aModalIsOpen } from "@/components/ui/modalOpen";
// ---------------------------------------------------------------------------
// THE REVIEW PASS (umtool redesign L7b; the workspace's `?mode=review`): the inspector hidden, the viewer playing
@@ -243,6 +244,8 @@ export default function ReviewPass({
if (ev.metaKey || ev.ctrlKey || ev.altKey) return;
// A held key is one answer, never a run of them over blocks nobody watched.
if (ev.repeat) return;
+ // A modal is up (⌘K, the Keys): the keys are its.
+ if (aModalIsOpen()) return;
const t = ev.target as HTMLElement | null;
if (t?.closest("input, textarea, select, [contenteditable=true], [role=dialog]")) return;
if (ev.key === "k" || ev.key === "K") void keys.current.go("keep", null);
diff --git a/umtool/components/ui/modalOpen.ts b/umtool/components/ui/modalOpen.ts
@@ -0,0 +1,7 @@
+// Is a modal up anywhere on the page -- a native <dialog> opened modally (the ⌘K palette), or an element that says
+// `aria-modal="true"` (the workspace's Keys)? A page's own keys stand aside while one is, whatever has the focus:
+// the modal has the keyboard (umtool redesign L7b: the review pass's k f n, present mode's arrows and Esc).
+export function aModalIsOpen(): boolean {
+ if (typeof document === "undefined") return false;
+ return !!document.querySelector("dialog[open], [aria-modal='true']");
+}
diff --git a/umtool/e2e/present.spec.ts b/umtool/e2e/present.spec.ts
@@ -198,6 +198,15 @@ test("in the workspace: Present ⛶ is the deck full screen, the arrows move it,
await expect(root(page)).toHaveAttribute("data-present-slide", "c01");
await expect(page).toHaveURL(/mode=present#c01$/);
await shot(page, "ws-present.png");
+ // ⌘K over the deck: its Esc closes the palette, never present mode under it; the arrows are the palette's.
+ await page.keyboard.press("Control+k");
+ const jump = page.locator("dialog[open]");
+ await expect(jump).toBeVisible();
+ await page.keyboard.press("ArrowRight");
+ await expect(root(page)).toHaveAttribute("data-present-slide", "c01");
+ await page.keyboard.press("Escape");
+ await expect(jump).toHaveCount(0);
+ await expect(root(page)).toHaveCount(1);
// Esc: the settings first, when open; then back to Edit.
await page.keyboard.press("s");
await expect(page.locator("[data-present-settings]")).toBeVisible();
diff --git a/umtool/e2e/review-pass.spec.ts b/umtool/e2e/review-pass.spec.ts
@@ -104,6 +104,20 @@ test("a reload resumes at block 4; so does the pass entered afresh (the first bl
"c03:",
"c04:",
]);
+ // Under a modal (the Keys), k answers nothing -- even with the focus nowhere in it; a held k is one press.
+ const manifestNow = readFileSync(path.join(DIR, "video.manifest.json"), "utf8");
+ const marksNow = readFileSync(path.join(DIR, "review-pass.json"), "utf8");
+ await page.keyboard.press("?");
+ await expect(page.locator("[data-ws-keys]")).toBeVisible();
+ await page.evaluate(() => (document.activeElement as HTMLElement | null)?.blur());
+ await page.keyboard.press("k");
+ await page.waitForTimeout(400);
+ expect(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")).toBe(manifestNow);
+ expect(readFileSync(path.join(DIR, "review-pass.json"), "utf8")).toBe(marksNow);
+ await expect(pass(page)).toHaveAttribute("data-review-current", "k01");
+ await page.keyboard.press("Escape");
+ await expect(page.locator("[data-ws-keys]")).toHaveCount(0);
+
// The CLI twin reads the same answers.
const { reviewPassCommand } = await import("../lib/report/reviewPass.mjs");
const out: string[] = [];