mirror of
https://github.com/privacyguides/privacyguides.org
synced 2024-12-01 07:23:30 +01:00
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 <span>, it won't work, since now this span is clicked, not .nav-summary. Closes #1549
This commit is contained in:
parent
905c2e5deb
commit
c4b0c4ed23
@ -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;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user