aboutsummaryrefslogtreecommitdiffstats
path: root/static/app.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-13 17:44:43 +0100
committerDanilo M. <danix@danix.xyz>2026-11-13 17:44:43 +0100
commit573f63f72ae66e2765609138e393a96293566184 (patch)
tree751645662d2a1e45ccca408c3bad17c8ac406d05 /static/app.js
parent6b03740a8c9fb98b788549412f0ebf3cbae1d2de (diff)
downloaddeck-it-573f63f72ae66e2765609138e393a96293566184.tar.gz
deck-it-573f63f72ae66e2765609138e393a96293566184.zip
fix(dim): close an open panel before a cover shows
A modal dialog is drawn in the top layer, over any z-index, so the dim clock and the asleep cover appeared under an open running-chip panel. Both covers now close every open dialog first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/app.js')
-rw-r--r--static/app.js6
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.