diff --git a/manon/accordion.js b/manon/accordion.js index f9f14fe8..c6b72df6 100644 --- a/manon/accordion.js +++ b/manon/accordion.js @@ -45,7 +45,7 @@ function initAccordion(accordion) { } // Set up the initial `aria-expanded` state. - if (button.getAttribute("aria-expanded")) { + if (button.getAttribute("aria-expanded") === "true") { hasAriaExpandedMarkup = true; } else { button.setAttribute("aria-expanded", "false"); @@ -62,7 +62,7 @@ function initAccordion(accordion) { } // Expand the first item by default - if (!hasAriaExpandedMarkup) { + if (!hasAriaExpandedMarkup && buttons.length) { buttons[0].setAttribute("aria-expanded", "true"); } }