commit 3818b739d4d223fcab2ad6d7463720a3e5fa8979
parent cea93aace9d0f32e8de5e0b0a3fc6b25c059a4ae
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 30 Oct 2026 19:18:21 -0400
umtool bench: the Escape Reject ▾ took is not the bench's too, whichever listener runs first
cea93aac's isOpen() guard only held when the bench's window listener ran first.
When RejectClip's ran first, its setPhase is a discrete update React flushes in a
microtask BETWEEN the two listeners, so the bench already read isOpen() false and
dropped the gap selection -- a later g then armed a new pick instead of cutting
(gaps-zoom.spec:166). The bench now also honours e.defaultPrevented, which
RejectClip sets on the Escape that closes its reasons.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/umtool/components/projects/ClipBench.tsx b/umtool/components/projects/ClipBench.tsx
@@ -2088,7 +2088,10 @@ export default function ClipBench({ data }: { data: ClipBenchData }) {
break;
case "Escape":
// Reject ▾'s reasons are up: the Escape closes them (RejectClip), nothing else.
- if (rejectCtl.current?.isOpen()) return;
+ // Both checks: when RejectClip's listener ran first it already closed them
+ // (React flushes that discrete update in a microtask between the two window
+ // listeners, so isOpen() is false by now) and marked the event handled.
+ if (e.defaultPrevented || rejectCtl.current?.isOpen()) return;
if (gapPick || gapSel) {
setGapPick(false);
setGapSel(null);
diff --git a/umtool/components/projects/review/RejectClip.tsx b/umtool/components/projects/review/RejectClip.tsx
@@ -43,7 +43,9 @@ export type RejectClipTarget = {
/**
* The page's handle on the reasons: `open` them (its own `x`), and whether they
* are up (`isOpen`) -- while they are, Escape is theirs to close, so a page's
- * own Escape (the bench's: drop the gap selection) leaves it alone.
+ * own Escape (the bench's: drop the gap selection) leaves it alone. The Escape
+ * that closes them is preventDefault()ed, so a page listener that runs after
+ * this one (by then `isOpen` is already false) can tell it was taken.
*/
export type RejectClipControl = { open: () => void; isOpen: () => boolean };