Skip to content

Commit

Permalink
Fix popup jumping on opening
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrsKondratjevs committed Nov 1, 2022
1 parent f3667fc commit 4b0b5fc
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class OverlayComponent<P extends OverlayComponentProps = OverlayComponent

overlayRef = createRef<HTMLDivElement>();

YoffsetWhenScrollDisabled = window.pageYOffset || document.body.scrollTop;
YoffsetWhenScrollDisabled = 0;

componentDidUpdate(prevProps: P): void {
const prevWasVisible = this.getIsVisible(prevProps);
Expand Down Expand Up @@ -91,6 +91,7 @@ export class OverlayComponent<P extends OverlayComponentProps = OverlayComponent
}

freezeScroll(): void {
this.YoffsetWhenScrollDisabled = window.pageYOffset || document.body.scrollTop;
toggleScroll(false);
document.body.style.marginTop = `${-this.YoffsetWhenScrollDisabled}px`;
}
Expand Down

0 comments on commit 4b0b5fc

Please sign in to comment.