Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions assets/scripts/components/table-of-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ export function onScroll() {
const windowTopPosition = scrollTop(window);
const windowHeight = window.innerHeight;
let localOffset = 65;


const getHeaderTop = (header) => {
// Treat hidden headings (e.g. display:none) as being below the
// scroll-spy threshold so they are never active/highlighted in TOC.
const rect = header.getBoundingClientRect();
return rect.height === 0 && rect.width === 0 ? (localOffset+1) : rect.top;
}

const isCustomizableDoc = document.getElementById('cdoc-selector') ? true : false;
if (isCustomizableDoc) {
localOffset += 65;
Expand Down Expand Up @@ -147,9 +154,9 @@ export function onScroll() {

if (
windowTopPosition !== 0 &&
sideNavItem.header.getBoundingClientRect().top <= 0 + localOffset &&
getHeaderTop(sideNavItem.header) <= localOffset &&
(typeof nextSideNavItem === 'undefined' ||
nextSideNavItem.header.getBoundingClientRect().top > 0 + localOffset)
getHeaderTop(nextSideNavItem.header) > localOffset)
) {
sideNavItem.navLink.classList.add('toc_scrolled');
// Add toc open to parents of this toc_scrolled
Expand Down
1 change: 1 addition & 0 deletions assets/styles/instantsearch/search-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

.ais-SearchBox-input {
background-color: #e6e6e6;
padding-right: 30px;
}

#count {
Expand Down
1 change: 1 addition & 0 deletions assets/styles/instantsearch/searchbar-with-dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
.ais-SearchBox-input {
font-feature-settings: 'lnum' 1;
padding-left: 9px;
padding-right: 30px;
margin-right: 8px;

&:focus-visible {
Expand Down
Loading