Skip to content

Commit

Permalink
Merge pull request #15156 from primefaces/issue-14949
Browse files Browse the repository at this point in the history
Fixed #14949 - Dialog | Missing Aria Label on Maximize button
  • Loading branch information
cetincakiroglu authored Mar 26, 2024
2 parents a5677fd + f8ee175 commit d5ec062
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/app/components/api/primengconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ export class PrimeNGConfig {
listLabel: 'Option List',
selectColor: 'Select a color',
removeLabel: 'Remove',
browseFiles: 'Browse Files'
browseFiles: 'Browse Files',
maximizeLabel: 'Maximize'
}
};

Expand Down
1 change: 1 addition & 0 deletions src/app/components/api/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ export interface Aria {
selectColor?: string;
removeLabel?: string;
browseFiles?: string;
maximizeLabel?: string;
}
7 changes: 6 additions & 1 deletion src/app/components/dialog/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
ViewEncapsulation,
ViewRef
} from '@angular/core';
import { Footer, Header, PrimeNGConfig, PrimeTemplate, SharedModule } from 'primeng/api';
import { Footer, Header, PrimeNGConfig, PrimeTemplate, SharedModule, TranslationKeys } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
import { FocusTrapModule } from 'primeng/focustrap';
import { TimesIcon } from 'primeng/icons/times';
Expand Down Expand Up @@ -101,6 +101,7 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{
(click)="maximize()"
(keydown.enter)="maximize()"
[attr.tabindex]="maximizable ? '0' : '-1'"
[attr.aria-label]="maximizeLabel"
pRipple
pButton
>
Expand Down Expand Up @@ -540,6 +541,10 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy {

private window: Window;

get maximizeLabel(): string {
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) {
this.window = this.document.defaultView as Window;
}
Expand Down

0 comments on commit d5ec062

Please sign in to comment.