diff options
Diffstat (limited to 'static/app.js')
| -rw-r--r-- | static/app.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/static/app.js b/static/app.js index 0466372..60cbb9f 100644 --- a/static/app.js +++ b/static/app.js @@ -233,6 +233,9 @@ setInterval(refreshTheme, 5000); // dims or starts its screensaver. The lock drops whenever the page is hidden // and is taken again when it comes back. 127.0.0.1 is a secure context, which // the Wake Lock API requires. +// An open modal (a running chip's panel) sits in the top layer, over any +// z-index, so the covers close it rather than show under it. +const closeDialogs = () => document.querySelectorAll("dialog[open]").forEach((d) => d.close()); const asleep = document.getElementById("asleep"); let wakeLock = null; async function keepAwake() { @@ -255,6 +258,7 @@ keepAwake(); const ASLEEP_AFTER = 15000; function goodnight(title) { document.getElementById("asleep-title").textContent = title; + closeDialogs(); asleep.hidden = false; wakeLock?.release(); } @@ -280,7 +284,7 @@ const tablet = (action) => fetch(`/api/tablet/${action}`, { }).catch(() => {}); function touched() { clearTimeout(dimTimer); - if (dimAfter > 0) dimTimer = setTimeout(() => { dimmer.hidden = false; tick(); tablet("dim"); }, dimAfter * 1000); + if (dimAfter > 0) dimTimer = setTimeout(() => { closeDialogs(); dimmer.hidden = false; tick(); tablet("dim"); }, dimAfter * 1000); } dimmer.addEventListener("click", () => { dimmer.hidden = true; tablet("undim"); }); // A clock on the cover, so the dim tablet still tells the time at a glance. |
