Skip to content

Commit

Permalink
Fixed #10923 - Calendar | Escape Support For Month and Year Picker
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Dec 6, 2021
1 parent 16369cf commit 10e9021
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export interface LocaleSettings {
<span class="p-datepicker-prev-icon pi pi-chevron-left"></span>
</button>
<div class="p-datepicker-title">
<button type="button" (click)="switchToMonthView($event)" *ngIf="currentView === 'date'" class="p-datepicker-month p-link" [disabled]="switchViewButtonDisabled()">
<button type="button" (click)="switchToMonthView($event)" (keydown)="onContainerButtonKeydown($event)" *ngIf="currentView === 'date'" class="p-datepicker-month p-link" [disabled]="switchViewButtonDisabled()">
{{getMonthName(month.month)}}
</button>
<button type="button" (click)="switchToYearView($event)" *ngIf="currentView !== 'year'" class="p-datepicker-year p-link" [disabled]="switchViewButtonDisabled()">
<button type="button" (click)="switchToYearView($event)" (keydown)="onContainerButtonKeydown($event)" *ngIf="currentView !== 'year'" class="p-datepicker-year p-link" [disabled]="switchViewButtonDisabled()">
{{currentYear}}
</button>
<span class="p-datepicker-decade" *ngIf="currentView === 'year'">
Expand Down Expand Up @@ -1628,6 +1628,13 @@ export class Calendar implements OnInit,OnDestroy,ControlValueAccessor {
break;
}

//escape
case 27: {
this.overlayVisible = false;
event.preventDefault();
break;
}

//tab
case 9: {
if (!this.inline) {
Expand Down

0 comments on commit 10e9021

Please sign in to comment.