Skip to content

Commit f65ef85

Browse files
committed
Wait until first observation to initially hide overlapped sidebars
A url that scrolls the page to an overlapping region would not hide the sidebar properly since the elements were not yet observed. (e.g. https://quarto.org/docs/authoring/article-layout.html#margin-references)
1 parent 42e2f9e commit f65ef85

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/resources/formats/html/quarto.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
531531
});
532532
}
533533

534+
let hasObserved = false;
534535
const visibleItemObserver = (els) => {
535536
let visibleElements = [];
536537
const intersectionObserver = new IntersectionObserver(
@@ -546,6 +547,11 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
546547
});
547548
}
548549
});
550+
551+
if (!hasObserved) {
552+
hideOverlappedSidebars();
553+
}
554+
hasObserved = true;
549555
},
550556
{}
551557
);
@@ -600,7 +606,6 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
600606
slowTransition(readerMode);
601607
}
602608
highlightReaderToggle(readerMode);
603-
hideOverlappedSidebars();
604609

605610
// If we're exiting reader mode, restore the non-slow transition
606611
if (!readerMode) {

0 commit comments

Comments
 (0)