Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DP-20201: Fix scroll issues noticed on iOS #1210

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions changelogs/DP-20201.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Fixed:
- project: Patternlab
component: Header
description: Move window scrollTo and remove inline body styling when closing the global nav menu. (#1210)
issue: DP-20201
impact: Patch
- project: Patternlab
component: Header
description: Move window scrollTo and remove inline body styling when closing the global nav menu. (#1210)
issue: DP-20209
impact: Patch
Original file line number Diff line number Diff line change
Expand Up @@ -462,16 +462,10 @@ function closeMenu() {
}

if (body.style.position === "fixed") {
body.style.position = "relative";
// At the same time, the alert needs to be scrolled up to the position again to retain the page elements position.
window.scrollTo(0, alertlOffsetPosition);
body.removeAttribute("style");
}
// When the page is loaded first time, body initially has "top: 0;".
// As the menu closes, reset the override top value to 0.
// Note: The top value is recognized as a string, not number.
if (body.style.top.indexOf("-") !== -1) {
body.style.top = 0;
}
// At the same time, the alert needs to be scrolled up to the position again to retain the page elements position.
window.scrollTo(0, alertlOffsetPosition);
}

function commonCloseMenuTasks() {
Expand Down