Skip to content

Commit cfce553

Browse files
authored
fix(month-view/year-view): create onMouseDown events (#15291)
1 parent f878746 commit cfce553

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
@@ -136,6 +136,15 @@ export class IgxMonthsViewComponent extends IgxCalendarViewDirective implements
136136
super(dayInterval);
137137
}
138138

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

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
@@ -155,4 +155,13 @@ export class IgxYearsViewComponent extends IgxCalendarViewDirective implements C
155155
year: this.yearFormat,
156156
});
157157
}
158+
159+
/**
160+
* @hidden
161+
*/
162+
protected onMouseDown() {
163+
if (this.tabIndex !== -1) {
164+
this.el.nativeElement.focus();
165+
}
166+
}
158167
}

0 commit comments

Comments
 (0)