From 573f63f72ae66e2765609138e393a96293566184 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 13 Nov 2026 17:44:43 +0100 Subject: 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 --- static/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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. -- cgit v1.2.3