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.
This commit is contained in:
yetone
2026-10-30 11:12:22 +08:00
parent d19afb4c9b
commit 6db21d8694
+5 -2
View File
@@ -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; }