fix: keep glossary entry details open on compact viewports
All checks were successful
SMOKE / smoke (push) Successful in 4s
CI / build-and-anchors (push) Successful in 38s
CI / build-and-anchors (pull_request) Successful in 34s

This commit is contained in:
2026-04-26 14:04:30 +02:00
parent 8a14ea1d7a
commit 2e4bc8f583

View File

@@ -2718,6 +2718,16 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
const isGlossaryCompactViewport = () =>
isGlossaryEdition &&
(mqGlossaryCompact.matches || mqGlossaryCompactLandscape.matches);
function forceOpenGlossaryEntryDetails() {
if (!isGlossaryEntryMode || !reading) return;
reading.querySelectorAll("details.details-section").forEach((details) => {
details.open = true;
});
}
forceOpenGlossaryEntryDetails();
function disableFollowForCompactGlossary() {
followEl.classList.remove("is-on");
@@ -2745,16 +2755,11 @@ const WHOAMI_FORCE_LOCALHOST = (import.meta.env.PUBLIC_WHOAMI_FORCE_LOCALHOST ??
}
if (isGlossaryHomeMode || isGlossaryCompactViewport()) {
forceOpenGlossaryEntryDetails();
disableFollowForCompactGlossary();
return;
}
if (isGlossaryEntryMode) {
reading.querySelectorAll("details.details-section").forEach((details) => {
details.open = true;
});
}
const h1 = reading.querySelector("h1");
const topChapterLabel =