Skip to content

Commit

Permalink
Fix error in ToC script at the bottom of the page (#2002)
Browse files Browse the repository at this point in the history
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
  • Loading branch information
zecakeh authored Nov 19, 2024
1 parent 0ce8351 commit 0657cc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assets/js/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ function getCurrentHeading(headings, headerOffset) {
index += 1;
}

// At the bottom of the page we might not have a heading.
if (!currentHeading) {
currentHeading = prevHeading;
}

return currentHeading;
}

Expand Down
1 change: 1 addition & 0 deletions changelogs/internal/newsfragments/2002.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve the JS script to highlight the current ToC entry.

0 comments on commit 0657cc1

Please sign in to comment.