Skip to content

Commit

Permalink
gave ios-disable-scroll the correct behavior for non localnavs as well
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmrj committed Jan 7, 2025
1 parent bd5829e commit 84b04f9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,8 @@ class Gnav {
const section = sections[0];
queueMicrotask(() => section.click());
}
} else if (isExpanded && this.newMobileNav) {
enableMobileScroll();
}
toggle?.setAttribute('aria-expanded', !isExpanded);
document.body.classList.toggle('disable-scroll', !isExpanded);
Expand Down Expand Up @@ -1128,10 +1130,12 @@ class Gnav {
dropdownTrigger.addEventListener('click', (e) => {
if (!isDesktop.matches && this.newMobileNav && isSectionMenu) {
const popup = dropdownTrigger.nextElementSibling;
const y = Math.abs(parseInt(document.body.style.top, 10));
// document.body.style.top should always be set
// at this point by calling disableMobileScroll
if (popup) popup.style.top = `calc(${y || 0}px - var(--feds-height-nav) - 1px)`;
if (popup && this.isLocalNav()) {
const y = Math.abs(parseInt(document.body.style.top, 10));
popup.style.top = `calc(${y || 0}px - var(--feds-height-nav) - 1px)`;
}
makeTabActive(popup);
} else if (isDesktop.matches && this.newMobileNav && isSectionMenu) {
const popup = dropdownTrigger.nextElementSibling;
Expand Down

0 comments on commit 84b04f9

Please sign in to comment.