Skip to content

Commit 151d808

Browse files
authored
misc(docs): handle case where sideMenu is already expanded on page load (#1135)
1 parent 37837c9 commit 151d808

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/dokka-presets/scripts/accessibility.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ function ensureNavButtonInteractable() {
8383
// Make the navButton focusable, add accessibility information
8484
navButton.setAttribute('tabindex', '0');
8585
navButton.setAttribute('role', 'button');
86-
navButton.setAttribute('aria-expanded', 'false');
86+
87+
const sideMenuPartParent = navButton.closest(".sideMenuPart")
88+
const navButtonExpanded = sideMenuPartParent ? (sideMenuPartParent.classList.contains('hidden') ? 'false' : 'true') : 'false'
89+
navButton.setAttribute('aria-expanded', navButtonExpanded);
8790

8891
// Grab the page ID, use it for aria-label and aria-controls
8992
const sectionName = navButton.parentElement.parentElement.getAttribute('pageid')

0 commit comments

Comments
 (0)