« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js/client/sticky-heading.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/static/js/client/sticky-heading.js')
-rw-r--r--src/static/js/client/sticky-heading.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/static/js/client/sticky-heading.js b/src/static/js/client/sticky-heading.js
index b65574d0..c69e137f 100644
--- a/src/static/js/client/sticky-heading.js
+++ b/src/static/js/client/sticky-heading.js
@@ -1,5 +1,3 @@
-/* eslint-env browser */
-
 import {filterMultipleArrays, stitchArrays} from '../../shared-util/sugar.js';
 import {cssProp, dispatchInternalEvent, templateContent}
   from '../client-util.js';
@@ -255,7 +253,11 @@ function getContentHeadingClosestToStickySubheading(index) {
 
   // Iterate from bottom to top of the content area.
   const contentHeadings = info.contentHeadings[index];
-  for (const heading of contentHeadings.slice().reverse()) {
+  for (const heading of contentHeadings.toReversed()) {
+    if (heading.nodeName === 'SUMMARY' && !heading.closest('details').open) {
+      continue;
+    }
+
     const headingRect = heading.getBoundingClientRect();
     if (headingRect.y + headingRect.height / 1.5 < stickyBottom + 40) {
       return heading;