Skip to content

Commit

Permalink
Merge pull request scandipwa#5275 from AleksandrsKondratjevs/issue-5254
Browse files Browse the repository at this point in the history
issue-5254 - Fix popup jumping on opening
  • Loading branch information
AleksandrsKondratjevs authored Nov 3, 2022
2 parents ae3b702 + 4b0b5fc commit b5fdd25
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 b5fdd25

Please sign in to comment.