From d5abf55cd4068a61b75a6d719295f25a01d5f38d Mon Sep 17 00:00:00 2001 From: Jan Klopper Date: Wed, 10 Jul 2024 22:22:32 +0200 Subject: [PATCH] Update accordion.js, closes #444 (#574) --- manon/accordion.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"); } }