From e9618013dc3486cffb06bf387f623e5247afa5f4 Mon Sep 17 00:00:00 2001 From: Rieven Date: Mon, 28 Oct 2024 16:18:03 +0100 Subject: [PATCH] Update rocky/assets/js/dropdown.js Co-authored-by: Peter-Paul van Gemerden --- rocky/assets/js/dropdown.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rocky/assets/js/dropdown.js b/rocky/assets/js/dropdown.js index 15fdd16f29a..adfe831fea4 100644 --- a/rocky/assets/js/dropdown.js +++ b/rocky/assets/js/dropdown.js @@ -38,8 +38,9 @@ document.addEventListener("click", () => { const activeButton = document.querySelector( ".dropdown-button[aria-expanded='true']", ); + const activeDropdown = activeButton?.closest(".dropdown"); - if (activeButton) { + if (activeDropdown && !activeDropdown.contains(e.target)) { const activeList = document.getElementById( activeButton.getAttribute("aria-controls"), );