diff --git a/assets/js/toc.js b/assets/js/toc.js index af8682b3..89a83ced 100644 --- a/assets/js/toc.js +++ b/assets/js/toc.js @@ -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; } diff --git a/changelogs/internal/newsfragments/2002.clarification b/changelogs/internal/newsfragments/2002.clarification new file mode 100644 index 00000000..5f641bff --- /dev/null +++ b/changelogs/internal/newsfragments/2002.clarification @@ -0,0 +1 @@ +Improve the JS script to highlight the current ToC entry.