diff --git a/assets/js/sidebar/sidebar-list.js b/assets/js/sidebar/sidebar-list.js index d7a6a7172..5838d61f3 100644 --- a/assets/js/sidebar/sidebar-list.js +++ b/assets/js/sidebar/sidebar-list.js @@ -192,10 +192,15 @@ function markCurrentHashInSidebar () { if (!current) return // Unset previous. - sidebar.querySelectorAll('li a[aria-selected]').forEach(element => { + sidebar.querySelectorAll('.full-list a[aria-selected]').forEach(element => { element.removeAttribute('aria-selected') }) + // Close open menus. + sidebar.querySelectorAll('.full-list button[aria-expanded=true]').forEach(element => { + element.setAttribute('aria-expanded', false) + }) + // Walk up parents, updating link, button and tab attributes. let element = current.parentElement while (element) {