Skip to content

Commit

Permalink
fixed an issue where firefox treats position fixed as position absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmrj committed Jan 7, 2025
1 parent 204cb8b commit 376f378
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ class Gnav {
// at this point by calling disableMobileScroll
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)`;
popup.style = `top: calc(${y || 0}px - var(--feds-height-nav))`;
}
makeTabActive(popup);
} else if (isDesktop.matches && this.newMobileNav && isSectionMenu) {
Expand Down
3 changes: 3 additions & 0 deletions libs/blocks/global-navigation/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
import { getFederatedContentRoot, getFederatedUrl, getFedsPlaceholderConfig } from '../../../utils/federated.js';
import { processTrackingLabels } from '../../../martech/attributes.js';
import { replaceText } from '../../../features/placeholders.js';
import { PERSONALIZATION_TAGS } from '../../../features/personalization/personalization.js';

loadLana();

Expand Down Expand Up @@ -414,11 +415,13 @@ export const closeAllTabs = (tabs, tabpanels) => {
};

export const disableMobileScroll = () => {
if (!PERSONALIZATION_TAGS.safari()) return;
document.body.style.top = `-${window.scrollY}px`;
document.body.classList.add('disable-ios-scroll');
};

export const enableMobileScroll = () => {
if (!PERSONALIZATION_TAGS.safari()) return;
if (!document.body.style.top) return;
const y = Math.abs(parseInt(document.body.style.top, 10));
if (Number.isNaN(y)) return;
Expand Down

0 comments on commit 376f378

Please sign in to comment.