Skip to content

Commit dbf949b

Browse files
wnvkojelbourn
authored andcommitted
feat(datepicker): remove mat-button and add only role button, #16406
1 parent 3cfbd82 commit dbf949b

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

src/material/datepicker/calendar-body.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@
4040
(click)="_cellClicked(item)"
4141
[style.width]="_cellWidth"
4242
[style.paddingTop]="_cellPadding"
43+
role="button"
4344
[style.paddingBottom]="_cellPadding">
44-
<button class="mat-calendar-body-cell-content"
45-
mat-button type="button"
46-
[attr.aria-label]="item.displayValue"
45+
<div class="mat-calendar-body-cell-content"
4746
[class.mat-calendar-body-selected]="selectedValue === item.value"
4847
[class.mat-calendar-body-today]="todayValue === item.value">
4948
{{item.displayValue}}
50-
</button>
49+
</div>
5150
</td>
5251
</tr>

src/material/datepicker/calendar-body.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ $mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-mar
6161
// Choosing a value clearly larger than the height ensures we get the correct capsule shape.
6262
border-radius: 999px;
6363

64-
// Override mat-button defaults
65-
min-width: 0;
66-
border-color: transparent;
67-
6864
@include cdk-high-contrast {
6965
border: none;
7066
}

src/material/datepicker/calendar.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,15 @@ describe('MatCalendar', () => {
7070

7171
let todayCell = calendarElement.querySelector('.mat-calendar-body-today')!;
7272
expect(todayCell).not.toBeNull();
73-
let todayCellSpan = todayCell.querySelector('span')!;
74-
expect(todayCellSpan).not.toBeNull();
75-
expect(todayCellSpan.innerHTML.trim()).toBe('1');
73+
expect(todayCell.innerHTML.trim()).toBe('1');
7674

7775
fakeToday = new Date(2018, 0, 10);
7876
calendarInstance.updateTodaysDate();
7977
fixture.detectChanges();
8078

8179
todayCell = calendarElement.querySelector('.mat-calendar-body-today')!;
8280
expect(todayCell).not.toBeNull();
83-
todayCellSpan = todayCell.querySelector('span')!;
84-
expect(todayCellSpan).not.toBeNull();
85-
expect(todayCellSpan.innerHTML.trim()).toBe('10');
81+
expect(todayCell.innerHTML.trim()).toBe('10');
8682
}));
8783

8884
it('should be in month view with specified month active', () => {

0 commit comments

Comments
 (0)