Skip to content

Commit

Permalink
issue-228 Scroll issues with hamburger fixed (#229)
Browse files Browse the repository at this point in the history
Co-authored-by: piyushjindal <[email protected]>
  • Loading branch information
jindaliiita and piyushjindal authored May 14, 2023
1 parent e609a5b commit e7a1159
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion blocks/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,13 @@ async function delayedNavTools() {
closeLoginModal();
document.body.classList.remove('overflow-hidden');
}
nav.setAttribute('aria-expanded', expanded ? 'false' : 'true');

// Setting both primary and secondary nav aria-expanded
document.querySelector('primary-nav').setAttribute('aria-expanded', expanded ? 'false' : 'true');
document.querySelector('secondary-nav').setAttribute('aria-expanded', expanded ? 'false' : 'true');

toggleHamburger();
window.scrollTo(0, 0); // Scrolling to Top
});

const querySearch = nav.querySelector('.nav-tools-search');
Expand Down
8 changes: 6 additions & 2 deletions blocks/header/nav-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ export async function loadNavTools() {
});

externalMarkup.appendChild(hamburgerModal);
document.querySelector('.nbd-hamburger-close-icon').addEventListener('click', () => {
document.querySelector('.nav-hamburger').click();

const icons = document.querySelectorAll('.nbd-hamburger-close-icon');
icons.forEach((x) => {
x.addEventListener('click', () => {
document.querySelector('.nav-hamburger').click();
});
});
}

Expand Down

0 comments on commit e7a1159

Please sign in to comment.