From 51f441c1707eda3c26be297c97b8c7cab3241c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Wed, 26 Jun 2024 12:16:42 +0300 Subject: [PATCH 1/2] Fixed #15155 - Component: Dropdown Accessibility --- src/app/components/dropdown/dropdown.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/app/components/dropdown/dropdown.ts b/src/app/components/dropdown/dropdown.ts index cdc9379fcdf..cadd3505b85 100755 --- a/src/app/components/dropdown/dropdown.ts +++ b/src/app/components/dropdown/dropdown.ts @@ -269,6 +269,8 @@ export class DropdownItem {
+ + this.getOptionLabel(this.selectedOption) || this.modelValue() || ''); - constructor( - public el: ElementRef, - public renderer: Renderer2, - public cd: ChangeDetectorRef, - public zone: NgZone, - public filterService: FilterService, - public config: PrimeNGConfig - ) { + constructor(public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef, public zone: NgZone, public filterService: FilterService, public config: PrimeNGConfig) { effect(() => { const modelValue = this.modelValue(); const visibleOptions = this.visibleOptions(); From e0edd92f43e8d29a2df3c154ce9ccb86f70d873b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:24:43 +0300 Subject: [PATCH 2/2] Fixed #15155 - Component: Dropdown Accessibility --- src/app/components/calendar/calendar.ts | 10 ++++++- src/app/components/carousel/carousel.ts | 10 ++++++- .../components/confirmdialog/confirmdialog.ts | 10 ++++++- src/app/components/dialog/dialog.ts | 10 ++++++- src/app/components/dropdown/dropdown.ts | 15 ++++++---- src/app/components/toast/toast.ts | 28 +++++++++++++------ 6 files changed, 66 insertions(+), 17 deletions(-) diff --git a/src/app/components/calendar/calendar.ts b/src/app/components/calendar/calendar.ts index 4f6ada6b797..ce82665acba 100644 --- a/src/app/components/calendar/calendar.ts +++ b/src/app/components/calendar/calendar.ts @@ -1169,7 +1169,15 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { return this.currentView === 'year' ? this.getTranslation('nextDecade') : this.currentView === 'month' ? this.getTranslation('nextYear') : this.getTranslation('nextMonth'); } - constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef, private zone: NgZone, private config: PrimeNGConfig, public overlayService: OverlayService) { + constructor( + @Inject(DOCUMENT) private document: Document, + public el: ElementRef, + public renderer: Renderer2, + public cd: ChangeDetectorRef, + private zone: NgZone, + private config: PrimeNGConfig, + public overlayService: OverlayService + ) { this.window = this.document.defaultView as Window; } diff --git a/src/app/components/carousel/carousel.ts b/src/app/components/carousel/carousel.ts index 1409301165e..bf4277a2956 100755 --- a/src/app/components/carousel/carousel.ts +++ b/src/app/components/carousel/carousel.ts @@ -357,7 +357,15 @@ export class Carousel implements AfterContentInit { window: Window; - constructor(public el: ElementRef, public zone: NgZone, public cd: ChangeDetectorRef, private renderer: Renderer2, @Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, private config: PrimeNGConfig) { + constructor( + public el: ElementRef, + public zone: NgZone, + public cd: ChangeDetectorRef, + private renderer: Renderer2, + @Inject(DOCUMENT) private document: Document, + @Inject(PLATFORM_ID) private platformId: any, + private config: PrimeNGConfig + ) { this.totalShiftedItems = this.page * this.numScroll * -1; this.window = this.document.defaultView as Window; } diff --git a/src/app/components/confirmdialog/confirmdialog.ts b/src/app/components/confirmdialog/confirmdialog.ts index 666aa4f344d..fac1115f0d4 100755 --- a/src/app/components/confirmdialog/confirmdialog.ts +++ b/src/app/components/confirmdialog/confirmdialog.ts @@ -442,7 +442,15 @@ export class ConfirmDialog implements AfterContentInit, OnInit, OnDestroy { translationSubscription: Subscription | undefined; - constructor(public el: ElementRef, public renderer: Renderer2, private confirmationService: ConfirmationService, public zone: NgZone, private cd: ChangeDetectorRef, public config: PrimeNGConfig, @Inject(DOCUMENT) private document: Document) { + constructor( + public el: ElementRef, + public renderer: Renderer2, + private confirmationService: ConfirmationService, + public zone: NgZone, + private cd: ChangeDetectorRef, + public config: PrimeNGConfig, + @Inject(DOCUMENT) private document: Document + ) { this.subscription = this.confirmationService.requireConfirmation$.subscribe((confirmation) => { if (!confirmation) { this.hide(); diff --git a/src/app/components/dialog/dialog.ts b/src/app/components/dialog/dialog.ts index 93918923200..acca8be9754 100755 --- a/src/app/components/dialog/dialog.ts +++ b/src/app/components/dialog/dialog.ts @@ -546,7 +546,15 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { return this.config.getTranslation(TranslationKeys.ARIA)['maximizeLabel']; } - constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, public el: ElementRef, public renderer: Renderer2, public zone: NgZone, private cd: ChangeDetectorRef, public config: PrimeNGConfig) { + constructor( + @Inject(DOCUMENT) private document: Document, + @Inject(PLATFORM_ID) private platformId: any, + public el: ElementRef, + public renderer: Renderer2, + public zone: NgZone, + private cd: ChangeDetectorRef, + public config: PrimeNGConfig + ) { this.window = this.document.defaultView as Window; } diff --git a/src/app/components/dropdown/dropdown.ts b/src/app/components/dropdown/dropdown.ts index 6cab9e021b4..28fedad1d4a 100755 --- a/src/app/components/dropdown/dropdown.ts +++ b/src/app/components/dropdown/dropdown.ts @@ -268,9 +268,7 @@ export class DropdownItem {
-
- - +
this.getOptionLabel(this.selectedOption) || this.modelValue() || ''); - constructor(public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef, public zone: NgZone, public filterService: FilterService, public config: PrimeNGConfig) { + constructor( + public el: ElementRef, + public renderer: Renderer2, + public cd: ChangeDetectorRef, + public zone: NgZone, + public filterService: FilterService, + public config: PrimeNGConfig + ) { effect(() => { const modelValue = this.modelValue(); const visibleOptions = this.visibleOptions(); @@ -1825,7 +1830,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV } hasFocusableElements() { - return DomHandler.getFocusableElements(this.overlayViewChild.overlayViewChild.nativeElement, ':not([data-p-hidden-focusable="true"])').length > 0; + return DomHandler.getFocusableElements(this.overlayViewChild.overlayViewChild.nativeElement, ':not([data-p-hidden-focusable="true"]):not([class="p-dropdown-items-wrapper"])').length > 0; } onBackspaceKey(event: KeyboardEvent, pressedInInputText = false) { diff --git a/src/app/components/toast/toast.ts b/src/app/components/toast/toast.ts index 3a3a94448db..2da996bd85f 100755 --- a/src/app/components/toast/toast.ts +++ b/src/app/components/toast/toast.ts @@ -150,7 +150,10 @@ export class ToastItem implements AfterViewInit, OnDestroy { timeout: any; - constructor(private zone: NgZone, private config: PrimeNGConfig) {} + constructor( + private zone: NgZone, + private config: PrimeNGConfig + ) {} ngAfterViewInit() { this.initTimeout(); @@ -159,12 +162,15 @@ export class ToastItem implements AfterViewInit, OnDestroy { initTimeout() { if (!this.message?.sticky) { this.zone.runOutsideAngular(() => { - this.timeout = setTimeout(() => { - this.onClose.emit({ - index: this.index, - message: this.message - }); - }, this.message?.life || this.life || 3000); + this.timeout = setTimeout( + () => { + this.onClose.emit({ + index: this.index, + message: this.message + }); + }, + this.message?.life || this.life || 3000 + ); }); } } @@ -343,7 +349,13 @@ export class Toast implements OnInit, AfterContentInit, OnDestroy { _position: ToastPositionType = 'top-right'; - constructor(@Inject(DOCUMENT) private document: Document, private renderer: Renderer2, public messageService: MessageService, private cd: ChangeDetectorRef, public config: PrimeNGConfig) {} + constructor( + @Inject(DOCUMENT) private document: Document, + private renderer: Renderer2, + public messageService: MessageService, + private cd: ChangeDetectorRef, + public config: PrimeNGConfig + ) {} styleElement: any;