Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertCarreras committed Sep 20, 2024
1 parent dbe5382 commit 59ac858
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/gestalt/src/SheetMobile/PartialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,22 @@ export default function PartialPage({

// When SheetMobile is full page displayed in mobile browser, the body scroll is still accessible. Here we disable to just allow the scrolling within Modal
useEffect(() => {
let prevOverflowStyle = 'auto';
let prevOverflowStyleVirtual = 'auto';
// eslint-disable-next-line no-console
console.log('useEffect');

if (isOnScreenKeyboardOpen) {
// @ts-expect-error - TS2339 - Property 'body' does not exist on type 'Window & typeof globalThis'.
if (window && window.body?.style?.overflow && isOnScreenKeyboardOpen) {
// @ts-expect-error - TS2339 - Property 'body' does not exist on type 'Window & typeof globalThis'.
prevOverflowStyle = window.body.style.overflow;
prevOverflowStyleVirtual = window.body.style.overflow;
// @ts-expect-error - TS2339 - Property 'body' does not exist on type 'Window & typeof globalThis'.
window.body.style.overflow = 'hidden';
}

if (!isOnScreenKeyboardOpen) {
// @ts-expect-error - TS2339 - Property 'body' does not exist on type 'Window & typeof globalThis'.
if (window && window.body?.style?.overflow && !isOnScreenKeyboardOpen) {
// @ts-expect-error - TS2339 - Property 'body' does not exist on type 'Window & typeof globalThis'.
if (window && window.body?.style?.overflow) {
// @ts-expect-error - TS2339 - Property 'body' does not exist on type 'Window & typeof globalThis'.
window.body.style.overflow = prevOverflowStyle;
}
window.body.style.overflow = prevOverflowStyleVirtual;
}
}, [isOnScreenKeyboardOpen]);

Expand Down

0 comments on commit 59ac858

Please sign in to comment.