Skip to content

Commit

Permalink
Fix navigation: close open dropdown on click of toggle item. Dropdown…
Browse files Browse the repository at this point in the history
… would always stay open before.

Signed-off-by: David Edler <david.edler@canonical.com>
  • Loading branch information
edlerd authored and bartaz committed Sep 30, 2022
1 parent 98c61f5 commit fcd5978
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion templates/docs/examples/patterns/navigation/_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ function initNavDropdowns(containerClass) {
toggle.addEventListener('click', function (e) {
e.preventDefault();

const shouldOpen = !toggle.parentNode.classList.contains('is-active');
closeAllDropdowns(toggles);
toggleDropdown(toggle, true);
toggleDropdown(toggle, shouldOpen);
});
});
}

0 comments on commit fcd5978

Please sign in to comment.