Skip to content

Commit

Permalink
Mobile gnav bugfixes (#3452)
Browse files Browse the repository at this point in the history
* fixed popup on page with promo and mainmenu

* Gave the body a min-height
  • Loading branch information
sharmrj authored Jan 10, 2025
1 parent 3db4ef2 commit 238c097
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libs/blocks/global-navigation/global-navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -1101,9 +1101,9 @@ header.new-nav .feds-breadcrumbs li:first-child:not(:nth-last-child(-n+3)):after
/* local-nav */
.feds-localnav {
position: sticky;
top: 0;
top: 0px;
width: 100%;
left: 0;
left: 0px;
z-index: 9;
}

Expand Down Expand Up @@ -1317,7 +1317,7 @@ header.new-nav .feds-breadcrumbs li:first-child:not(:nth-last-child(-n+3)):after
.disable-ios-scroll {
overflow: hidden;
width: 100%;
height: 100dvh;
min-height: 100dvh;
position: fixed;
}

Expand Down
3 changes: 2 additions & 1 deletion libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ class Gnav {
localNavItems[0].querySelector('a').textContent = title.trim();
const isAtTop = () => {
const rect = this.elements.localNav.getBoundingClientRect();
// note: ios safari changes between -0.34375, 0, and 0.328125
return rect.top === 0;
};
window.addEventListener('scroll', () => {
Expand Down Expand Up @@ -1173,7 +1174,7 @@ class Gnav {
const popup = dropdownTrigger.nextElementSibling;
// document.body.style.top should always be set
// at this point by calling disableMobileScroll
if (popup && this.isLocalNav()) {
if (popup) {
const y = window.scrollY;
const iOSy = Math.abs(parseInt(document.body.style.top, 10));
const offset = this.block.classList.contains('has-promo')
Expand Down

0 comments on commit 238c097

Please sign in to comment.