Skip to content

Commit

Permalink
Fixes #13734 - Add missing class to prevent scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Sep 25, 2023
1 parent 396297a commit 360868d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/components/blockui/blockui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export class BlockUI implements AfterViewInit, OnDestroy {
this.target.getBlockableElement().style.position = 'relative';
} else {
this.renderer.appendChild(this.document.body, (this.mask as ElementRef).nativeElement);
DomHandler.addClass(this.document.body, 'p-overflow-hidden');
this.document.body.style.setProperty('--scrollbar-width', DomHandler.calculateScrollbarWidth() + 'px');
}

if (this.autoZIndex) {
Expand All @@ -124,9 +126,11 @@ export class BlockUI implements AfterViewInit, OnDestroy {
destroyModal() {
this._blocked = false;
if (this.mask) {
DomHandler.removeClass(this.mask.nativeElement, 'p-component-overlay-leave');
ZIndexUtils.clear(this.mask.nativeElement);
this.renderer.appendChild(this.el.nativeElement, this.mask.nativeElement);
DomHandler.removeClass(this.mask.nativeElement, 'p-component-overlay-leave');
this.renderer.removeChild(this.el.nativeElement, this.mask.nativeElement);
DomHandler.removeClass(this.document.body, 'p-overflow-hidden');
this.document.body.style.removeProperty('--scrollbar-width');
}
this.unbindAnimationEndListener();
this.cd.markForCheck();
Expand Down

0 comments on commit 360868d

Please sign in to comment.