diff options
| -rw-r--r-- | src/app.js | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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) { |
