From db13056723c0c13fcf9ea98ed258a619f9654ab8 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 16 Nov 2026 17:24:13 +0100 Subject: fix(xbox): a redrawn hold never fires, and start clears the flag A power button rebuilt mid-hold lost its pointerup, so letting go early still turned the console off; hold.js now drops a hold whose button is no longer in the page. status.xbox is written 0 on start, in case a crash left it at 1. The "ago" texts move on each minute, and missing storage names and achievement percentages no longer print null. Co-Authored-By: Claude Opus 5.5 --- static/hold.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'static/hold.js') diff --git a/static/hold.js b/static/hold.js index e937a25..9f2b8da 100644 --- a/static/hold.js +++ b/static/hold.js @@ -36,7 +36,8 @@ export function hold(btn, fire, { ms = HOLD_MS, tap } = {}) { e.stopPropagation(); btn.setPointerCapture(e.pointerId); btn.classList.add("holding"); - timer = setTimeout(() => { cancel(); buzz(); fire(); }, ms); + // A button redrawn away mid-hold has lost its pointerup: drop the hold. + timer = setTimeout(() => { const live = btn.isConnected; cancel(); if (live) { buzz(); fire(); } }, ms); }); btn.addEventListener("pointerup", () => { if (timer && tap) tap(); -- cgit v1.2.3