diff --git a/src/app/components/dialog/dialog.ts b/src/app/components/dialog/dialog.ts index 569db64500a..86c95b75613 100755 --- a/src/app/components/dialog/dialog.ts +++ b/src/app/components/dialog/dialog.ts @@ -19,6 +19,7 @@ import { PLATFORM_ID, QueryList, Renderer2, + SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation, @@ -73,13 +74,13 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{ (@animation.start)="onAnimationStart($event)" (@animation.done)="onAnimationEnd($event)" role="dialog" - [attr.aria-labelledby]="getAriaLabelledBy()" + [attr.aria-labelledby]="ariaLabelledBy" [attr.aria-modal]="true" >
- {{ header }} - + {{ header }} + @@ -464,6 +465,8 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { dragging: boolean | undefined; + ariaLabelledBy: string | undefined; + documentDragListener: VoidListener; documentDragEndListener: VoidListener; @@ -554,6 +557,12 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { } } + ngOnChanges(changes: SimpleChanges): void { + if (changes.header) { + this.ariaLabelledBy = this.getAriaLabelledBy(); + } + } + getAriaLabelledBy() { return this.header !== null ? UniqueComponentId() + '_header' : null; }