Skip to content

Commit

Permalink
Making localnav close on curtain click
Browse files Browse the repository at this point in the history
  • Loading branch information
bandana147 committed Jan 14, 2025
1 parent 170d0f7 commit bf0647b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class Gnav {
});

localNav.querySelector('.feds-localnav-curtain').addEventListener('click', (e) => {
trigger({ element: e.currentTarget, event: e });
trigger({ element: e.currentTarget, event: e, type: 'localNav-curtain' });
});
this.elements.localNav = localNav;
localNavItems[0].querySelector('a').textContent = title.trim();
Expand Down Expand Up @@ -1046,7 +1046,6 @@ class Gnav {
elem?.setAttribute('aria-expanded', false);
elem?.addEventListener('click', (e) => {
trigger({ element: e.currentTarget, event: e, type: 'headline' });
setActiveDropdown(e.currentTarget);
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/global-navigation/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export function setActiveDropdown(elem, type) {
const resetActiveDropdown = () => {
[...document.querySelectorAll(selectors.activeDropdown)]
.forEach((activeDropdown) => activeDropdown.classList.remove(activeClass));
if (type && type !== 'localNavItem' && type !== 'headline') {
if (!type || type === 'localNav-curtain') {
[...document.querySelectorAll(activeLocalNav)]
.forEach((activeDropdown) => activeDropdown.classList.remove('feds-localnav--active'));
}
Expand Down

0 comments on commit bf0647b

Please sign in to comment.