From e8ac96d125390614cf3f80bc59cf03714095e080 Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sat, 9 Sep 2023 16:07:27 +0200 Subject: [PATCH 1/3] Added ariaLabelledBy onInit --- src/app/components/dialog/dialog.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/components/dialog/dialog.ts b/src/app/components/dialog/dialog.ts index bb7a21fcb6f..6d28a578998 100755 --- a/src/app/components/dialog/dialog.ts +++ b/src/app/components/dialog/dialog.ts @@ -73,13 +73,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 +464,8 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { dragging: boolean | undefined; + ariaLabelledBy: string | undefined; + documentDragListener: VoidListener; documentDragEndListener: VoidListener; @@ -549,6 +551,7 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { } ngOnInit() { + this.ariaLabelledBy = this.getAriaLabelledBy() if (this.breakpoints) { this.createStyle(); } @@ -1003,4 +1006,4 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { exports: [Dialog, SharedModule], declarations: [Dialog] }) -export class DialogModule {} +export class DialogModule { } From 08785e1e98e9bc4b06c138dd50da2fe71bd48c46 Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sat, 9 Sep 2023 16:08:10 +0200 Subject: [PATCH 2/3] formatted files --- src/app/components/dialog/dialog.ts | 4 ++-- src/app/components/fileupload/fileupload.ts | 4 ++-- src/app/components/menu/menu.ts | 2 +- src/app/components/tieredmenu/tieredmenu.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/components/dialog/dialog.ts b/src/app/components/dialog/dialog.ts index 6d28a578998..30a167fe9f2 100755 --- a/src/app/components/dialog/dialog.ts +++ b/src/app/components/dialog/dialog.ts @@ -551,7 +551,7 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { } ngOnInit() { - this.ariaLabelledBy = this.getAriaLabelledBy() + this.ariaLabelledBy = this.getAriaLabelledBy(); if (this.breakpoints) { this.createStyle(); } @@ -1006,4 +1006,4 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { exports: [Dialog, SharedModule], declarations: [Dialog] }) -export class DialogModule { } +export class DialogModule {} diff --git a/src/app/components/fileupload/fileupload.ts b/src/app/components/fileupload/fileupload.ts index 89f2e018818..4915f03dd72 100755 --- a/src/app/components/fileupload/fileupload.ts +++ b/src/app/components/fileupload/fileupload.ts @@ -467,7 +467,7 @@ export class FileUpload implements AfterViewInit, AfterContentInit, OnInit, OnDe private http: HttpClient, public cd: ChangeDetectorRef, public config: PrimeNGConfig - ) { } + ) {} ngAfterContentInit() { this.templates?.forEach((item) => { @@ -901,4 +901,4 @@ export class FileUpload implements AfterViewInit, AfterContentInit, OnInit, OnDe exports: [FileUpload, SharedModule, ButtonModule, ProgressBarModule, MessagesModule], declarations: [FileUpload] }) -export class FileUploadModule { } +export class FileUploadModule {} diff --git a/src/app/components/menu/menu.ts b/src/app/components/menu/menu.ts index 2418ba21800..8699bc99323 100755 --- a/src/app/components/menu/menu.ts +++ b/src/app/components/menu/menu.ts @@ -607,7 +607,7 @@ export class Menu implements OnDestroy { changeFocusedOptionIndex(index) { const links = DomHandler.find(this.containerViewChild.nativeElement, 'li[data-pc-section="menuitem"][data-p-disabled="false"]'); - if(links.length > 0) { + if (links.length > 0) { let order = index >= links.length ? links.length - 1 : index < 0 ? 0 : index; order > -1 && this.focusedOptionIndex.set(links[order].getAttribute('id')); } diff --git a/src/app/components/tieredmenu/tieredmenu.ts b/src/app/components/tieredmenu/tieredmenu.ts index 9330fbd843e..a044a0a6e8c 100755 --- a/src/app/components/tieredmenu/tieredmenu.ts +++ b/src/app/components/tieredmenu/tieredmenu.ts @@ -222,7 +222,7 @@ export class TieredMenuSub { @ViewChild('sublist', { static: true }) sublistViewChild: ElementRef; - constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public renderer: Renderer2, private cd: ChangeDetectorRef,@Inject(forwardRef(() => TieredMenu)) public tieredMenu: TieredMenu) {} + constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public renderer: Renderer2, private cd: ChangeDetectorRef, @Inject(forwardRef(() => TieredMenu)) public tieredMenu: TieredMenu) {} positionSubmenu() { let sublist = this.sublistViewChild && this.sublistViewChild.nativeElement; From 28d08c5063bda2ede9fd44f8ddf9ffd18db921fb Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sun, 24 Sep 2023 17:44:05 +0200 Subject: [PATCH 3/3] Added logic in ngOnChanges --- src/app/components/dialog/dialog.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/components/dialog/dialog.ts b/src/app/components/dialog/dialog.ts index 30a167fe9f2..49a87468979 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, @@ -551,12 +552,17 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { } ngOnInit() { - this.ariaLabelledBy = this.getAriaLabelledBy(); if (this.breakpoints) { this.createStyle(); } } + ngOnChanges(changes: SimpleChanges): void { + if (changes.header) { + this.ariaLabelledBy = this.getAriaLabelledBy(); + } + } + getAriaLabelledBy() { return this.header !== null ? UniqueComponentId() + '_header' : null; }