aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-30 13:45:05 -0700
committerAdam Soltys <[email protected]>2026-10-30 13:45:05 -0700
commit5ee7b8ffbb57ca800a145c1ff8ede3aeff5b0dc6 (patch)
tree42f6841bb86196b2e8da17f37c6c803c5a443cc6
parent10dec87bc74e1f16464d3c61c378a2acd8b029c3 (diff)
downloadcoinosv3-5ee7b8ffbb57ca800a145c1ff8ede3aeff5b0dc6.tar.gz
coinosv3-5ee7b8ffbb57ca800a145c1ff8ede3aeff5b0dc6.zip
A toast no longer sticks on screen for good. One raised while the app was in the background (a zap failing after you switched away) was hidden by its timer before it ever showed, because a hidden tab pauses requestAnimationFrame but not setTimeout; on return it showed and nothing took it down (Adam's phone, 2026-10-30). The hide timer now starts when the toast actually shows
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6VLgQdujavxPsfU7A9
-rw-r--r--src/app.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/app.js b/src/app.js
index 9789401..f9e326a 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1117,9 +1117,16 @@ function toast(msg, ms = 1600) {
document.body.append(t);
}
t.textContent = msg;
- requestAnimationFrame(() => t.classList.add('show'));
clearTimeout(toastTimer);
- toastTimer = setTimeout(() => t.classList.remove('show'), ms);
+ // The hide timer starts when the toast shows: a hidden tab pauses
+ // requestAnimationFrame but not setTimeout, so a toast raised in the
+ // background (a zap failing after you switched apps) used to be hidden
+ // first and shown on return, then stay up for good.
+ requestAnimationFrame(() => {
+ t.classList.add('show');
+ clearTimeout(toastTimer);
+ toastTimer = setTimeout(() => t.classList.remove('show'), ms);
+ });
}
async function copy(text) {