Skip to content

Commit 294c6c9

Browse files
committed
fix: clicking on expanded nav link now closes it
1 parent 482a9d9 commit 294c6c9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

assets/multidoc_injector.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ require(["jquery"], function ($) {
1616
.classList.toggle("hidden-on-mobile");
1717
});
1818
document.body.addEventListener("click", function (ev) {
19+
const thisIsExpanded = ev.target.matches(".nav-expanded > .dropdown-label")
1920
if (!ev.target.matches(".nav-dropdown-container")) {
2021
Array.prototype.forEach.call(document.getElementsByClassName("dropdown-label"), function (el) {
21-
el.parentElement.classList.remove("nav-expanded")
22+
el.parentElement.classList.remove("nav-expanded");
2223
});
2324
}
24-
if (ev.target.matches(".dropdown-label")) {
25-
ev.target.parentElement.classList.add("nav-expanded")
25+
if (!thisIsExpanded && ev.target.matches(".dropdown-label")) {
26+
ev.target.parentElement.classList.add("nav-expanded");
2627
}
2728
})
2829
});

0 commit comments

Comments
 (0)