Skip to content

Commit

Permalink
Fix black bars on dialogs with preventsScroll enabled on ios 15 (#1526)
Browse files Browse the repository at this point in the history
fix(overlays): black bars on dialogs with preventsScroll enabled on ios 15
  • Loading branch information
Joel-Levi committed Nov 11, 2021
1 parent d449515 commit fdc5e73
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/short-horses-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@lion/overlays": patch
---

Fix: black bars on dialogs with preventsScroll enabled on ios 15.
See https://stackoverflow.com/questions/69589924/ios-15-minimized-address-bar-issue-with-fixed-position-full-screen-content
2 changes: 2 additions & 0 deletions packages/overlays/src/OverlaysManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export class OverlaysManager {
// iOS has issues with overlays with input fields. This is fixed by applying
// position: fixed to the body. As a side effect, this will scroll the body to the top.
document.body.classList.add('global-overlays-scroll-lock-ios-fix');
document.documentElement.classList.add('global-overlays-scroll-lock-ios-fix');
}
}

Expand All @@ -213,6 +214,7 @@ export class OverlaysManager {
document.body.classList.remove('global-overlays-scroll-lock');
if (isIOS) {
document.body.classList.remove('global-overlays-scroll-lock-ios-fix');
document.documentElement.classList.remove('global-overlays-scroll-lock-ios-fix');
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions packages/overlays/src/globalOverlaysStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,8 @@ export const globalOverlaysStyle = css`
position: fixed;
width: 100%;
}
html.global-overlays-scroll-lock-ios-fix {
height: 100vh;
}
`;

0 comments on commit fdc5e73

Please sign in to comment.