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:
Dawid Potocki 2019-12-01 10:15:15 +00:00 committed by GitHub
parent 905c2e5deb
commit c4b0c4ed23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
});