Skip to content

Commit

Permalink
Used event.preventDefault on a scroll event on the window to prevent …
Browse files Browse the repository at this point in the history
…scrolling in iOS
  • Loading branch information
sharmrj committed Jan 6, 2025
1 parent 061c5fa commit 573e2d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
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 @@ -422,7 +422,7 @@ class Gnav {
const rect = this.elements.localNav.getBoundingClientRect();
return rect.top === 0;
};
window.addEventListener('scroll', () => {
window.addEventListener('scroll', (event) => {
const classList = this.elements.localNav?.classList;
if (isAtTop()) {
if (!classList?.contains('is-sticky')) {
Expand All @@ -431,6 +431,7 @@ class Gnav {
} else {
classList?.remove('is-sticky');
}
event.preventDefault();
});
};

Expand Down
2 changes: 0 additions & 2 deletions libs/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,6 @@ header.global-navigation + .feds-localnav {

.disable-scroll {
overflow: hidden;
/* for iOS Safari */
position: absolute;
}

h1, h2, h3, h4, h5, h6 {
Expand Down

0 comments on commit 573e2d9

Please sign in to comment.