From 333a211ec3e7860e8d746696cec3fc96451f5c41 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 1 Nov 2026 20:02:13 +0100 Subject: dashboard: figures open on press --- src/api/dashboard/dashboard.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/api') diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index d8b8f6c..6490cd5 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -368,8 +368,20 @@ function tree(key, value, path) { if (details.open) open.add(path); else open.delete(path); }); const entries = Array.isArray(value) ? value.map((v, i) => [String(i), v]) : Object.entries(value); - details.append(el("summary", {}, el("span", { class: "key" }, key), - Array.isArray(value) ? " [" + value.length + "]" : "")); + const summary = el("summary", {}, el("span", { class: "key" }, key), + Array.isArray(value) ? " [" + value.length + "]" : ""); + // Opened or closed on press, as the peers' rows are focused: the tree is drawn anew + // every second (ages), and a click whose press and release land on two drawings is + // lost. Keys (Enter, space) still click. + summary.addEventListener("pointerdown", event => { + if (event.button !== 0) return; + event.preventDefault(); + details.open = !details.open; + }); + summary.addEventListener("click", event => { + if (event.detail !== 0) event.preventDefault(); + }); + details.append(summary); for (const [k, v] of entries) details.append(tree(k, v, path + "." + k)); return details; } -- cgit v1.3.1