Skip to content

Commit 867aac4

Browse files
authored
fix(month-view/year-view): create onMouseDown events (#15290)
1 parent 8d91cdb commit 867aac4

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

projects/igniteui-angular/src/lib/calendar/months-view/months-view.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
[date]="date"
1313
[showActive]="showActive"
1414
(itemSelection)="selectDate($event)"
15+
(mousedown)="onMouseDown()"
1516
>
1617
<span class="igx-calendar-view__item-inner" aria-hidden="true">
1718
{{ formattedMonth(month).formatted | titlecase }}

projects/igniteui-angular/src/lib/calendar/months-view/months-view.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ export class IgxMonthsViewComponent extends IgxCalendarViewDirective implements
135135
super(dayInterval);
136136
}
137137

138+
/**
139+
* @hidden
140+
*/
141+
protected onMouseDown() {
142+
if (this.tabIndex !== -1) {
143+
this.el.nativeElement.focus();
144+
}
145+
}
146+
138147
/**
139148
* Returns the locale representation of the month in the months view.
140149
*

projects/igniteui-angular/src/lib/calendar/years-view/years-view.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
[date]="date"
1414
[showActive]="showActive"
1515
(itemSelection)="selectDate($event)"
16+
(mousedown)="onMouseDown()"
1617
>
1718
<span class="igx-calendar-view__item-inner" aria-hidden="true">
1819
{{ formattedYear(year).formatted }}

projects/igniteui-angular/src/lib/calendar/years-view/years-view.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,13 @@ export class IgxYearsViewComponent extends IgxCalendarViewDirective implements C
154154
year: this.yearFormat,
155155
});
156156
}
157+
158+
/**
159+
* @hidden
160+
*/
161+
protected onMouseDown() {
162+
if (this.tabIndex !== -1) {
163+
this.el.nativeElement.focus();
164+
}
165+
}
157166
}

0 commit comments

Comments
 (0)