From c4b0c4ed23b3c699d2974bec05bd48dbd9e042bb Mon Sep 17 00:00:00 2001 From: Dawid Potocki Date: Sun, 1 Dec 2019 10:15:15 +0000 Subject: [PATCH] Fix collapsing navbar dropdown when clicking another element (#1552) JavaScript was checking if element clicked is exactly .nav-summary, which isn't a problem when just clicking text inside it, but if we try to click another element inside like , it won't work, since now this span is clicked, not .nav-summary. Closes #1549 --- assets/js/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/js/main.js b/assets/js/main.js index 548d1dd9..1aa56caf 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -25,7 +25,11 @@ function navSectionsToggle() { function navSectionsClose(event) { // Hide all dropdowns when clicking in different place - if (event.target.matches(".nav-summary")) return; + if ( + event.target.matches(".nav-summary") || + event.target.parentNode.matches(".nav-summary") + ) + return; navSections.forEach(navSection => { navSection.open = !open; });