Skip to content

Commit

Permalink
Fix broken focus, add missing pButton directives
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Feb 23, 2024
1 parent 155e72f commit 7c3efb4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/app/components/dialog/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { WindowMinimizeIcon } from 'primeng/icons/windowminimize';
import { RippleModule } from 'primeng/ripple';
import { Nullable, VoidListener } from 'primeng/ts-helpers';
import { UniqueComponentId, ZIndexUtils } from 'primeng/utils';
import { ButtonModule } from 'primeng/button';

const showAnimation = animation([style({ transform: '{{transform}}', opacity: 0 }), animate('{{transition}}')]);

Expand All @@ -49,6 +50,7 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{
*ngIf="maskVisible"
[class]="maskStyleClass"
[style]="maskStyle"
(focus)="containerFocus($event)"
[ngClass]="{
'p-dialog-mask': true,
'p-component-overlay p-component-overlay-enter': this.modal,
Expand Down Expand Up @@ -91,7 +93,17 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{
</span>
<ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
<div class="p-dialog-header-icons">
<button *ngIf="maximizable" role="button" type="button" [ngClass]="{ 'p-dialog-header-icon p-dialog-header-maximize p-link': true }" (click)="maximize()" (keydown.enter)="maximize()" tabindex="-1" pRipple>
<button
*ngIf="maximizable"
role="button"
type="button"
[ngClass]="{ 'p-dialog-header-icon p-dialog-header-maximize p-link': true }"
(click)="maximize()"
(keydown.enter)="maximize()"
[attr.tabindex]="maximizable ? '0' : '-1'"
pRipple
pButton
>
<span *ngIf="maximizeIcon && !maximizeIconTemplate && !minimizeIconTemplate" class="p-dialog-header-maximize-icon" [ngClass]="maximized ? minimizeIcon : maximizeIcon"></span>
<ng-container *ngIf="!maximizeIcon">
<WindowMaximizeIcon *ngIf="!maximized && !maximizeIconTemplate" [styleClass]="'p-dialog-header-maximize-icon'" />
Expand All @@ -111,8 +123,9 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{
[attr.aria-label]="closeAriaLabel"
(click)="close($event)"
(keydown.enter)="close($event)"
[attr.tabindex]="closeTabindex"
pRipple
pButton
[attr.tabindex]="closeTabindex"
>
<ng-container *ngIf="!closeIconTemplate">
<span *ngIf="closeIcon" class="p-dialog-header-close-icon" [ngClass]="closeIcon"></span>
Expand Down Expand Up @@ -333,7 +346,7 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy {
* Index of the close button in tabbing order.
* @group Props
*/
@Input() closeTabindex: string = '-1';
@Input() closeTabindex: string = '0';
/**
* Name of the minimize icon.
* @group Props
Expand Down Expand Up @@ -1024,7 +1037,7 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy {
}

@NgModule({
imports: [CommonModule, FocusTrapModule, RippleModule, TimesIcon, WindowMaximizeIcon, WindowMinimizeIcon],
imports: [CommonModule, FocusTrapModule, ButtonModule, RippleModule, TimesIcon, WindowMaximizeIcon, WindowMinimizeIcon],
exports: [Dialog, SharedModule],
declarations: [Dialog]
})
Expand Down

0 comments on commit 7c3efb4

Please sign in to comment.