From b9966eb0908c385bd0a8c23ad93e369d27930f56 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sat, 21 Nov 2026 20:40:55 -0500 Subject: [PATCH 1/2] fix(prototype): keep a notes-row click when the list re-renders mid-press render() rebuilt every notes row with replaceChildren on each server state push and each named or view reply from the frame. One landing between a row's mousedown and mouseup left the browser no click to fire, so choose() never ran, the row's actions stayed display:none, and the next click on Edit, Withdraw or Move or resize waited 30 s. That is the click timeout the explore-directions browser suites hit on CI. A render during a press in the list now waits until the click has been dispatched. notes-history-browser asserts a row click survives a render forced mid-press; it fails on the old host. Closes #18090 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RAoAtV6H7kcRVG5xeX1rtT --- .../fix-explore-directions-browser-flake-206077b3.md | 7 +++++++ lib/ui-feedback/host.mjs | 11 +++++++++++ plugins/prototype/notes-bridge/host.mjs | 11 +++++++++++ .../scripts/notes-history-browser-take.js | 11 +++++++++++ 4 files changed, 40 insertions(+) create mode 100644 .changes/prototype/fix-explore-directions-browser-flake-206077b3.md diff --git a/.changes/prototype/fix-explore-directions-browser-flake-206077b3.md b/.changes/prototype/fix-explore-directions-browser-flake-206077b3.md new file mode 100644 index 0000000000..54064bdd05 --- /dev/null +++ b/.changes/prototype/fix-explore-directions-browser-flake-206077b3.md @@ -0,0 +1,7 @@ +--- +bump: patch +--- + +### Fixed + +- The notes panel no longer drops a click on a note row when the list re-renders while the mouse button is down, for instance when the server pushes a state change. The row is selected and its Edit, Withdraw and Move or resize actions show, where before they stayed hidden. diff --git a/lib/ui-feedback/host.mjs b/lib/ui-feedback/host.mjs index 01462bccff..ededa3b7e3 100644 --- a/lib/ui-feedback/host.mjs +++ b/lib/ui-feedback/host.mjs @@ -600,7 +600,18 @@ function copyChosen(m) { else manual(); } +/** A row rebuilt between a press and its release gets no click, so a render during a press in the list waits for the click. */ +let pressed = false, stale = false; +const release = () => { + pressed = false; + if (stale) { stale = false; render(); } +}; +$("notes").addEventListener("pointerdown", () => { pressed = true; }); +addEventListener("click", release); +addEventListener("pointerup", () => setTimeout(release)); +addEventListener("pointercancel", release); function render() { + if (pressed) { stale = true; return; } const listening = noSession ? "No session: the notes server is not answering. Your notes stay on this page; Copy all notes makes a block to paste to Claude." : { listening: "Claude is listening.", reading: "Claude is reading your notes." }[last.listening] diff --git a/plugins/prototype/notes-bridge/host.mjs b/plugins/prototype/notes-bridge/host.mjs index a460dbf7cf..a6d31423d4 100644 --- a/plugins/prototype/notes-bridge/host.mjs +++ b/plugins/prototype/notes-bridge/host.mjs @@ -602,7 +602,18 @@ function copyChosen(m) { else manual(); } +/** A row rebuilt between a press and its release gets no click, so a render during a press in the list waits for the click. */ +let pressed = false, stale = false; +const release = () => { + pressed = false; + if (stale) { stale = false; render(); } +}; +$("notes").addEventListener("pointerdown", () => { pressed = true; }); +addEventListener("click", release); +addEventListener("pointerup", () => setTimeout(release)); +addEventListener("pointercancel", release); function render() { + if (pressed) { stale = true; return; } const listening = noSession ? "No session: the notes server is not answering. Your notes stay on this page; Copy all notes makes a block to paste to Claude." : { listening: "Claude is listening.", reading: "Claude is reading your notes." }[last.listening] diff --git a/plugins/prototype/skills/explore-directions/scripts/notes-history-browser-take.js b/plugins/prototype/skills/explore-directions/scripts/notes-history-browser-take.js index 6a961db07f..c99c39659a 100644 --- a/plugins/prototype/skills/explore-directions/scripts/notes-history-browser-take.js +++ b/plugins/prototype/skills/explore-directions/scripts/notes-history-browser-take.js @@ -99,6 +99,17 @@ async page => { await until(() => rows.nth(0).getAttribute("aria-current"), (v) => v === "true"); ok("clicking marker 1 selects row 1, as clicking the row does", (await rows.nth(0).getAttribute("aria-current")) === "true"); ok("and keeps note 1's variant with its box drawn", (await shownVariant()) === "A" && (await box("selected", ROW)).on, await shownVariant()); + + await page.click("#view-sep"); + const name = await rows.nth(1).locator(".name").boundingBox(); + await page.mouse.move(name.x + 4, name.y + 4); + await page.mouse.down(); + await frame.evaluate(() => parent.postMessage({ type: "named", names: [] }, "*")); + await page.waitForTimeout(200); + await page.mouse.up(); + await until(() => rows.nth(1).getAttribute("aria-current"), (v) => v === "true"); + ok("a click on row 2 selects it and shows its actions when the list re-renders mid-press", + (await rows.nth(1).getAttribute("aria-current")) === "true" && await rows.nth(1).locator('[data-key^="edit-"]').isVisible()); } catch (err) { R.push("ERROR " + String(err && err.message || err).slice(0, 300)); } From 88d63301d73a539a5000d3213d86a4196afb2016 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sat, 21 Nov 2026 21:47:58 -0500 Subject: [PATCH 2/2] fix(prototype): end the notes-row press hold on right-click, context menu, leave and blur Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RAoAtV6H7kcRVG5xeX1rtT --- .../fix-explore-directions-browser-flake-206077b3.md | 2 +- lib/ui-feedback/host.mjs | 5 ++++- plugins/prototype/notes-bridge/host.mjs | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.changes/prototype/fix-explore-directions-browser-flake-206077b3.md b/.changes/prototype/fix-explore-directions-browser-flake-206077b3.md index 54064bdd05..5cec01d191 100644 --- a/.changes/prototype/fix-explore-directions-browser-flake-206077b3.md +++ b/.changes/prototype/fix-explore-directions-browser-flake-206077b3.md @@ -4,4 +4,4 @@ bump: patch ### Fixed -- The notes panel no longer drops a click on a note row when the list re-renders while the mouse button is down, for instance when the server pushes a state change. The row is selected and its Edit, Withdraw and Move or resize actions show, where before they stayed hidden. +- The notes panel no longer drops a click on a note row when the list re-renders while the mouse button is down, for instance when the server pushes a state change. The row is selected and its Edit, Withdraw and Move or resize actions show, where before they stayed hidden. Only a primary-button press holds the re-render, and the hold ends when the pointer leaves the list, a context menu opens or the window loses focus, so the list never freezes after a right-click or a drag into the mockup. diff --git a/lib/ui-feedback/host.mjs b/lib/ui-feedback/host.mjs index ededa3b7e3..94085670f5 100644 --- a/lib/ui-feedback/host.mjs +++ b/lib/ui-feedback/host.mjs @@ -606,10 +606,13 @@ const release = () => { pressed = false; if (stale) { stale = false; render(); } }; -$("notes").addEventListener("pointerdown", () => { pressed = true; }); +$("notes").addEventListener("pointerdown", (e) => { if (e.button === 0) pressed = true; }); +$("notes").addEventListener("pointerleave", release); addEventListener("click", release); addEventListener("pointerup", () => setTimeout(release)); addEventListener("pointercancel", release); +addEventListener("contextmenu", release); +addEventListener("blur", release); function render() { if (pressed) { stale = true; return; } const listening = noSession diff --git a/plugins/prototype/notes-bridge/host.mjs b/plugins/prototype/notes-bridge/host.mjs index a6d31423d4..097812b970 100644 --- a/plugins/prototype/notes-bridge/host.mjs +++ b/plugins/prototype/notes-bridge/host.mjs @@ -608,10 +608,13 @@ const release = () => { pressed = false; if (stale) { stale = false; render(); } }; -$("notes").addEventListener("pointerdown", () => { pressed = true; }); +$("notes").addEventListener("pointerdown", (e) => { if (e.button === 0) pressed = true; }); +$("notes").addEventListener("pointerleave", release); addEventListener("click", release); addEventListener("pointerup", () => setTimeout(release)); addEventListener("pointercancel", release); +addEventListener("contextmenu", release); +addEventListener("blur", release); function render() { if (pressed) { stale = true; return; } const listening = noSession