Skip to content

Commit

Permalink
Merge pull request #14234 from ashikjs/issues-14230/blockui-break-oni…
Browse files Browse the repository at this point in the history
…nitial-set-true

fix: #14230 || BlockUI: entire page is blocked if "blocked" input con…
  • Loading branch information
cetincakiroglu committed Dec 20, 2023
2 parents 7f32209 + cf17076 commit 4a9c09c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/components/blockui/blockui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ZIndexUtils } from 'primeng/utils';
[class]="styleClass"
[attr.aria-busy]="blocked"
[ngClass]="{ 'p-blockui-document': !target, 'p-blockui p-component-overlay p-component-overlay-enter': true }"
[ngStyle]="{ display: blocked ? 'flex' : 'none' }"
[ngStyle]="{ display: 'none' }"
[attr.data-pc-name]="'blockui'"
[attr.data-pc-section]="'root'"
>
Expand Down Expand Up @@ -80,6 +80,8 @@ export class BlockUI implements AfterViewInit, OnDestroy {
constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig, private renderer: Renderer2, @Inject(PLATFORM_ID) public platformId: any) {}

ngAfterViewInit() {
if (this._blocked) this.block();

if (this.target && !this.target.getBlockableElement) {
throw 'Target of BlockUI must implement BlockableUI interface';
}
Expand All @@ -102,6 +104,7 @@ export class BlockUI implements AfterViewInit, OnDestroy {
block() {
if (isPlatformBrowser(this.platformId)) {
this._blocked = true;
(this.mask as ElementRef).nativeElement.style.display = 'flex'

if (this.target) {
this.target.getBlockableElement().appendChild((this.mask as ElementRef).nativeElement);
Expand Down

0 comments on commit 4a9c09c

Please sign in to comment.