From 6db21d86946ecd5f66bb1f3eadaa95d654fd8af2 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 30 Oct 2026 11:12:15 +0800 Subject: [PATCH] gui: the tray panel's header is fitted without a .side-top 4a4a90c23 made fitTop set .side-top.tight, but the tray panel (?mode=panel) has no sidebar and so no .side-top, and fitTop threw "Cannot read properties of null (reading 'classList')" there (WebKit: "null is not an object (evaluating 'st.classList')"). number-units' panel case counts page errors, so it was red on origin/main 4a4a90c23 in Chromium and WebKit, en and zh. fitTop now skips .side-top when the page has none. Run (on mote, through mote-run; playwright 1.62.0, chromium and webkit): - number-units.test.cjs at origin/main 4a4a90c23: 4 of its cases red with the errors above (also seen in a run of the sessions overview files at this base). - With the change: number-units and side-toggle, 32 of 32 pass. Not tried: the real tray panel on a desktop; the whole GUI suite. --- internal/gui/assets/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 073dabce9..77795837a 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -23591,9 +23591,12 @@ matchMedia("(max-width: 760px), (pointer: coarse) and (max-width: 1024px)").addE // further still when they don't fit (the 560px window at 150%). function fitTop() { const top = $(".top"), nav = $("#nav"), brand = $(".brand"), actions = $(".actions"); + // the tray panel has no sidebar, so no .side-top const st = $(".side-top"); - st.classList.remove("tight"); - st.classList.toggle("tight", st.scrollWidth > st.clientWidth); + if (st) { + st.classList.remove("tight"); + st.classList.toggle("tight", st.scrollWidth > st.clientWidth); + } // a phone's browser: the tabs have a row of their own (app.css), at their size; // and beside the sidebar the header holds only where the reader is and the icons if (phoneWeb() || sideNav()) { top.classList.remove("tight", "cramped", "inrow", "crowded", "packed"); return; }