Skip to content

Commit 0b1328a

Browse files
Close open menus on nav (#2010)
1 parent 22103e7 commit 0b1328a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

assets/js/sidebar/sidebar-list.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,15 @@ function markCurrentHashInSidebar () {
192192
if (!current) return
193193

194194
// Unset previous.
195-
sidebar.querySelectorAll('li a[aria-selected]').forEach(element => {
195+
sidebar.querySelectorAll('.full-list a[aria-selected]').forEach(element => {
196196
element.removeAttribute('aria-selected')
197197
})
198198

199+
// Close open menus.
200+
sidebar.querySelectorAll('.full-list button[aria-expanded=true]').forEach(element => {
201+
element.setAttribute('aria-expanded', false)
202+
})
203+
199204
// Walk up parents, updating link, button and tab attributes.
200205
let element = current.parentElement
201206
while (element) {

0 commit comments

Comments
 (0)