Skip to content

Commit

Permalink
misc(docs): handle case where sideMenu is already expanded on page lo…
Browse files Browse the repository at this point in the history
…ad (#1135)
  • Loading branch information
lauzadis authored Aug 2, 2024
1 parent 37837c9 commit 151d808
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/dokka-presets/scripts/accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 151d808

Please sign in to comment.