]> BookStack Code Mirror - bookstack/blobdiff - resources/js/services/util.js
LDAP: Review, testing and update of LDAP TLS CA cert control
[bookstack] / resources / js / services / util.js
index e6d93d61bd9620f1c28c555511342ef647713af5..942456d9dedb475ce3e6e05ad0a06ccdf2513ffd 100644 (file)
@@ -1,5 +1,3 @@
-import {elem} from './dom';
-
 /**
  * Returns a function, that, as long as it continues to be invoked, will not
  * be triggered. The function will be called after it stops being called for
 /**
  * Returns a function, that, as long as it continues to be invoked, will not
  * be triggered. The function will be called after it stops being called for
@@ -33,9 +31,12 @@ export function debounce(func, waitMs, immediate) {
 export function scrollAndHighlightElement(element) {
     if (!element) return;
 
 export function scrollAndHighlightElement(element) {
     if (!element) return;
 
-    const parentDetails = element.closest('details');
-    if (parentDetails && !parentDetails.open) {
-        parentDetails.open = true;
+    let parent = element;
+    while (parent.parentElement) {
+        parent = parent.parentElement;
+        if (parent.nodeName === 'DETAILS' && !parent.open) {
+            parent.open = true;
+        }
     }
 
     element.scrollIntoView({behavior: 'smooth'});
     }
 
     element.scrollIntoView({behavior: 'smooth'});