From 925b5941885d8ebcff01ab7c25671ed4d007538c Mon Sep 17 00:00:00 2001 From: thatguywob Date: Tue, 3 Nov 2026 16:36:36 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20keep=20Matrix=20overlays?= =?UTF-8?q?=20above=20terminal=20rendering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pin the canvas and freshness HUD to explicit layers and the CTA to viewport bottom insets. Reserve the measured overlay band for terminal rows, including resized cards and hidden CTAs. Hive-Run: hivecommons/hive#16440 Hive-Plan: matrix-overlay-visibility Hive-Spec: hivecommons/hive#16440#expected Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com> Signed-off-by: thatguywob --- changelog.d/fixed-16440-matrix-overlays.md | 1 + src/pkg/dashboard/kiosk_cta.test.js | 2 +- src/pkg/dashboard/matrix_ui_test.go | 31 +++++++++++++++++++-- src/pkg/dashboard/static-src/css/matrix.css | 6 ++-- src/pkg/dashboard/static-src/js/matrix.js | 7 +++++ src/pkg/dashboard/static/index.html | 13 +++++++-- 6 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 changelog.d/fixed-16440-matrix-overlays.md diff --git a/changelog.d/fixed-16440-matrix-overlays.md b/changelog.d/fixed-16440-matrix-overlays.md new file mode 100644 index 0000000000..764ed90176 --- /dev/null +++ b/changelog.d/fixed-16440-matrix-overlays.md @@ -0,0 +1 @@ +- Keep the Matrix freshness HUD and get-started QR card above the canvas in every effect, and reserve their space when scrolling terminal rows. diff --git a/src/pkg/dashboard/kiosk_cta.test.js b/src/pkg/dashboard/kiosk_cta.test.js index 7fbcef84f2..03cd295bfc 100644 --- a/src/pkg/dashboard/kiosk_cta.test.js +++ b/src/pkg/dashboard/kiosk_cta.test.js @@ -31,5 +31,5 @@ test('badge wiring: placeholder outside the root, hidden without the body class, assert.ok(root > 0 && ph > root, 'placeholder must follow the dashboard root'); assert.ok(html.includes('#kiosk-cta { display: none; }')); assert.ok(html.includes('body.kiosk-cta-on #kiosk-cta {')); - assert.ok(html.includes('body.matrix-mode #kiosk-cta { z-index: 100001; opacity: .85; }')); + assert.ok(html.includes('body.matrix-mode #kiosk-cta { position: fixed; right: 1rem; bottom: 1rem; z-index: 100001; opacity: .85; }')); }); diff --git a/src/pkg/dashboard/matrix_ui_test.go b/src/pkg/dashboard/matrix_ui_test.go index 3b2f0413dc..cfc937082d 100644 --- a/src/pkg/dashboard/matrix_ui_test.go +++ b/src/pkg/dashboard/matrix_ui_test.go @@ -45,6 +45,20 @@ func TestMatrixUIWiring(t *testing.T) { } } } + // The canvas must have an explicit lower layer even when its fill is opaque. + for selector, declarations := range map[string][]string{ + "body.matrix-mode .matrix-canvas": {"position: fixed", "z-index: 0"}, + "body.matrix-mode .matrix-labels": {"position: fixed", "z-index: 1", "bottom: 1rem"}, + "body.matrix-mode #kiosk-cta": {"position: fixed", "z-index: 100001", "bottom: 1rem"}, + } { + _, after, found := strings.Cut(css, selector+" {") + rule, _, _ := strings.Cut(after, "}") + for _, declaration := range declarations { + if !found || !strings.Contains(rule, declaration+";") { + t.Errorf("%s missing overlay layout declaration %q", selector, declaration) + } + } + } manifest := read("manifest.txt") for _, file := range []string{"js/matrix.js", "css/matrix.css"} { if !strings.Contains(manifest, file+"\n") { @@ -77,14 +91,16 @@ const matrix = fs.readFileSync('static-src/js/matrix.js', 'utf8'); const boot = fs.readFileSync('static-src/js/boot.js', 'utf8').split('})();')[0] + '})();'; async function scenario(query, reduced = false, status = 200) { const events = {}, docEvents = {}, raf = new Map(), timers = new Map(), requests = [], draws = []; - let id = 0, responseStatus = status, responseSeq = 1; + let id = 0, responseStatus = status, responseSeq = 1, overlayTop = 440; const context = {clearRect(){}, fillRect(){}, fillText(...a){draws.push(a)}, drawImage(...a){draws.push(a)}}; const elements = []; function el(tag) { const e = {tagName: tag.toUpperCase(), children: [], style: {setProperty(){}}, classList: {add(){}}, setAttribute(){}, append(...a){this.children.push(...a)}, + getBoundingClientRect(){return {top: this.id === 'kiosk-cta' ? overlayTop : 500, height: this.id === 'kiosk-cta' ? (query.includes('cta=off') ? 0 : 140) : 80}}, appendChild(a){this.children.push(a)}, replaceChildren(...a){this.children = a}, getContext(){return context}}; elements.push(e); return e; } const body = el('body'); + const cta = el('aside'); cta.id = 'kiosk-cta'; body.appendChild(cta); const doc = {body, hidden: false, createElement: el, getElementById(id){return elements.find(e => e.id === id)}, addEventListener(n, fn){(docEvents[n] ||= []).push(fn)}}; @@ -122,7 +138,17 @@ async function scenario(query, reduced = false, status = 200) { assert(draws.length > 0); if (/cascade|ghost|terminal/.test(query)) assert(draws.some(a => a[0] === 'org/repo#2 ยท main.go')); if (query.includes('ghost')) assert(draws.some(a => a[0] === 'main.go')); - if (query.includes('terminal')) assert(draws.some(a => a[0] === '+ ')); + if (query.includes('terminal')) { + assert(draws.some(a => a[0] === '+ ')); + assert(draws.every(a => a[2] <= (query.includes('cta=off') ? 500 : overlayTop) - 20), 'terminal rows must clear visible overlays'); + overlayTop = 320; draws.length = 0; + const fn = [...raf.values()][0]; raf.clear(); fn(200); + assert(draws.length > 0); + assert(draws.every(a => a[2] <= (query.includes('cta=off') ? 500 : overlayTop) - 20), 'terminal must follow resized overlays'); + } + assert(!byClass('matrix-labels').hidden); + assert(byClass('matrix-labels').children[1].textContent.includes('last line')); + assert.equal(win.hiveKioskCTAOn(win.location.href), !query.includes('cta=off')); } doc.hidden = true; docEvents.visibilitychange.forEach(fn => fn()); assert.equal(raf.size, 0); assert.equal(timers.size, 0); @@ -142,6 +168,7 @@ async function scenario(query, reduced = false, status = 200) { await scenario('?kiosk=1&view=matrix&mx.effect=cascade'); await scenario('?kiosk=1&view=matrix&mx.effect=ghost'); await scenario('?kiosk=1&view=matrix&mx.effect=terminal'); + await scenario('?kiosk=1&view=matrix&mx.effect=terminal&cta=off'); await scenario('?kiosk=1&view=matrix', true); for (const status of [404, 401, 403]) await scenario('?kiosk=1&view=matrix', false, status); })().catch(e => {console.error(e); process.exit(1)}); diff --git a/src/pkg/dashboard/static-src/css/matrix.css b/src/pkg/dashboard/static-src/css/matrix.css index b8c35ee708..a623782d5e 100644 --- a/src/pkg/dashboard/static-src/css/matrix.css +++ b/src/pkg/dashboard/static-src/css/matrix.css @@ -7,11 +7,11 @@ body.matrix-mode #hive-matrix { --matrix-muted: #b8ccbb; position: fixed; inset: 0; z-index: 100000; background: var(--matrix-bg); color: var(--matrix-color, var(--matrix-fg)); font: 16px monospace; } -body.matrix-mode .matrix-canvas { width: 100%; height: 100%; } -body.matrix-mode .matrix-labels { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; padding: var(--sp-3); background: var(--matrix-surface); color: var(--matrix-text); font-size: var(--fs-base); overflow-wrap: anywhere; } +body.matrix-mode .matrix-canvas { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; } +body.matrix-mode .matrix-labels { position: fixed; z-index: 1; bottom: 1rem; left: 1rem; right: 1rem; padding: var(--sp-3); background: var(--matrix-surface); color: var(--matrix-text); font-size: var(--fs-base); overflow-wrap: anywhere; } body.matrix-mode .matrix-notice { position: absolute; top: 2rem; left: 1rem; right: 1rem; color: var(--matrix-text); } body.matrix-mode .matrix-list { position: absolute; inset: 4rem 1rem 8rem; overflow: hidden; } body.matrix-mode .matrix-list pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0 1rem; } body.matrix-mode .matrix-list small { color: var(--matrix-muted); } body.matrix-mode #hive-matrix [hidden] { display: none !important; } -body.matrix-mode #kiosk-cta { z-index: 100001; opacity: .85; } +body.matrix-mode #kiosk-cta { position: fixed; right: 1rem; bottom: 1rem; z-index: 100001; opacity: .85; } diff --git a/src/pkg/dashboard/static-src/js/matrix.js b/src/pkg/dashboard/static-src/js/matrix.js index 0b1a0137b7..a73bf7175e 100644 --- a/src/pkg/dashboard/static-src/js/matrix.js +++ b/src/pkg/dashboard/static-src/js/matrix.js @@ -200,7 +200,14 @@ if (!termRows.length) emitTerminal(); termClock += dt * 4; while (termClock >= 1) { termClock -= 1; emitTerminal(); } + // The QR card can be taller than the freshness HUD. Reserve the full + // overlay band, including after viewport or font-size changes. var bottom = height - 100; + [labels, document.getElementById('kiosk-cta')].forEach(function(overlay){ + if (!overlay) return; + var bounds = overlay.getBoundingClientRect(); + if (bounds.height) bottom = Math.min(bottom, bounds.top - rowH); + }); ctx.font = '16px monospace'; termRows.forEach(function(row, i){ var y = bottom - (termRows.length - 1 - i + termClock) * rowH; diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 80065e550f..7b0c7f68f3 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -7035,14 +7035,14 @@ --matrix-muted: #b8ccbb; position: fixed; inset: 0; z-index: 100000; background: var(--matrix-bg); color: var(--matrix-color, var(--matrix-fg)); font: 16px monospace; } -body.matrix-mode .matrix-canvas { width: 100%; height: 100%; } -body.matrix-mode .matrix-labels { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; padding: var(--sp-3); background: var(--matrix-surface); color: var(--matrix-text); font-size: var(--fs-base); overflow-wrap: anywhere; } +body.matrix-mode .matrix-canvas { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; } +body.matrix-mode .matrix-labels { position: fixed; z-index: 1; bottom: 1rem; left: 1rem; right: 1rem; padding: var(--sp-3); background: var(--matrix-surface); color: var(--matrix-text); font-size: var(--fs-base); overflow-wrap: anywhere; } body.matrix-mode .matrix-notice { position: absolute; top: 2rem; left: 1rem; right: 1rem; color: var(--matrix-text); } body.matrix-mode .matrix-list { position: absolute; inset: 4rem 1rem 8rem; overflow: hidden; } body.matrix-mode .matrix-list pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0 1rem; } body.matrix-mode .matrix-list small { color: var(--matrix-muted); } body.matrix-mode #hive-matrix [hidden] { display: none !important; } -body.matrix-mode #kiosk-cta { z-index: 100001; opacity: .85; } +body.matrix-mode #kiosk-cta { position: fixed; right: 1rem; bottom: 1rem; z-index: 100001; opacity: .85; } .var-empty{color:var(--muted);font-size:var(--fs-sm);padding:var(--sp-2) var(--sp-0)} .var-section{margin-top:var(--sp-6);border-top:1px solid var(--border);padding-top:var(--sp-5)} .var-heading{font-weight:600;font-size:var(--fs-sm);margin-bottom:var(--sp-4)} @@ -7262,7 +7262,14 @@ if (!termRows.length) emitTerminal(); termClock += dt * 4; while (termClock >= 1) { termClock -= 1; emitTerminal(); } + // The QR card can be taller than the freshness HUD. Reserve the full + // overlay band, including after viewport or font-size changes. var bottom = height - 100; + [labels, document.getElementById('kiosk-cta')].forEach(function(overlay){ + if (!overlay) return; + var bounds = overlay.getBoundingClientRect(); + if (bounds.height) bottom = Math.min(bottom, bounds.top - rowH); + }); ctx.font = '16px monospace'; termRows.forEach(function(row, i){ var y = bottom - (termRows.length - 1 - i + termClock) * rowH;