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.
This commit is contained in:
yetone
2026-10-16 02:47:57 +08:00
parent 55d6ea4ffc
commit 1a16fc0b5b
+2 -2
View File
@@ -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");