fix: keep glossary entry details open on compact viewports
This commit is contained in:
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user