From e0347889fb0579a85020d96cbcbd5f8670b3beeb Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Fri, 2 Aug 2024 10:37:59 -0400 Subject: [PATCH] Handle case where sideMenu is already expanded on page load --- docs/dokka-presets/scripts/accessibility.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/dokka-presets/scripts/accessibility.js b/docs/dokka-presets/scripts/accessibility.js index bbb1994fa..0ea0e9087 100644 --- a/docs/dokka-presets/scripts/accessibility.js +++ b/docs/dokka-presets/scripts/accessibility.js @@ -83,7 +83,9 @@ 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") + navButton.setAttribute('aria-expanded', sideMenuPartParent.classList.contains('hidden') ? 'false' : 'true'); // Grab the page ID, use it for aria-label and aria-controls const sectionName = navButton.parentElement.parentElement.getAttribute('pageid')