diff --git a/docs/dokka-presets/scripts/accessibility.js b/docs/dokka-presets/scripts/accessibility.js index bbb1994fa..c27d4531e 100644 --- a/docs/dokka-presets/scripts/accessibility.js +++ b/docs/dokka-presets/scripts/accessibility.js @@ -83,7 +83,10 @@ function ensureNavButtonInteractable() { // Make the navButton focusable, add accessibility information navButton.setAttribute('tabindex', '0'); navButton.setAttribute('role', 'button'); - navButton.setAttribute('aria-expanded', 'false'); + + const sideMenuPartParent = navButton.closest(".sideMenuPart") + const navButtonExpanded = sideMenuPartParent ? (sideMenuPartParent.classList.contains('hidden') ? 'false' : 'true') : 'false' + navButton.setAttribute('aria-expanded', navButtonExpanded); // Grab the page ID, use it for aria-label and aria-controls const sectionName = navButton.parentElement.parentElement.getAttribute('pageid')