Skip to content

Commit 3ae79bb

Browse files
committed
fix(IgxMonthPicker): error should not be thown when press arrowLeft #8074
1 parent 4ff59bc commit 3ae79bb

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

projects/igniteui-angular/src/lib/calendar/month-picker/month-picker.component.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
139139
public changeYearKB(event, next = true) {
140140
if (event.key === KEYS.SPACE || event.key === KEYS.SPACE_IE || event.key === KEYS.ENTER) {
141141
event.stopPropagation();
142-
next ? this.nextYear(event) : this.previousYear(event);
142+
next ? this.nextYear() : this.previousYear();
143143
}
144144
}
145145

@@ -173,8 +173,6 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
173173
if (!value) {
174174
return new Date();
175175
}
176-
177-
// TO DO: to be refactored after discussion on the desired behavior
178176
super.selectDate(value);
179177
this.viewDate = value;
180178
}
@@ -183,8 +181,6 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
183181
* @hidden
184182
*/
185183
public writeValue(value: Date) {
186-
187-
// TO DO: to be refactored after discussion on the desired behavior
188184
if (value) {
189185
this.viewDate = this.selectedDates = value;
190186
}
@@ -196,7 +192,7 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
196192
@HostListener('keydown.pageup', ['$event'])
197193
public previousYear(event?: KeyboardEvent) {
198194
event?.preventDefault();
199-
if (this.yearAction === 'next') { return; }
195+
if (event && this.yearAction === 'next') { return; }
200196
this.yearAction = 'prev';
201197
this.viewDate = this.calendarModel.getPrevYear(this.viewDate);
202198
}
@@ -207,7 +203,7 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
207203
@HostListener('keydown.pagedown', ['$event'])
208204
public nextYear(event?: KeyboardEvent) {
209205
event?.preventDefault();
210-
if (this.yearAction === 'prev') { return; }
206+
if (event && this.yearAction === 'prev') { return; }
211207
this.yearAction = 'next';
212208
this.viewDate = this.calendarModel.getNextYear(this.viewDate);
213209
}

0 commit comments

Comments
 (0)