From 1a16fc0b5b43dcdc77b6212c49f98156a836bef6 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 16 Oct 2026 02:47:57 +0800 Subject: [PATCH] gui: Settings' scroll hairline holds its head instead of finding it on each scroll 8f55c27ad (#2396) looked up `:scope > .set-head` on every scroll of #view-settings. When the view's children are not the ones index.html drew, the lookup is null and every scroll throws; readable-focus, which replaces the view's children to test keyboard focus, went red on main (a61a6f954) in both engines with "Cannot read properties of null (reading 'classList')" / WebKit "null is not an object (evaluating 'sv.querySelector(":scope > .set-head").classList')". The head is now found once, when the tabs are set up, and the handler toggles that. Run at 55d6ea4ff + this change: readable-focus 8/0 (chromium, webkit), settings-*.test.cjs 108/0. --- internal/gui/assets/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index c9f9afd21..872b327a5 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -18301,8 +18301,8 @@ function setSetTab(tab, remember) { tabKeys(tabs, "button[data-set]"); // the tabs held at the top (app.css, #2396): a hairline under them once // the page has scrolled beneath, as the Library's - const sv = $("#view-settings"); - sv.addEventListener("scroll", () => sv.querySelector(":scope > .set-head").classList.toggle("stuck", sv.scrollTop > 0), { passive: true }); + const sv = $("#view-settings"), head = sv.querySelector(":scope > .set-head"); + sv.addEventListener("scroll", () => head.classList.toggle("stuck", sv.scrollTop > 0), { passive: true }); // opened on a part (a reload, a link): that part, and remembered if (mode === "window" && params.get("view") === "settings" && SET_TABS.includes(params.get("tab"))) { setTab = params.get("tab");