Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/material/datepicker/calendar-body.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}
<!--
Each gridcell in the calendar contains a button, which signals to assistive technology that the
cell is interactable, as well as the selection state via `aria-pressed`. See #23476 for
cell is interactable, as well as the selection state via `aria-selected`. See #23476 for
background.
-->
@for (item of row; track item.id; let colIndex = $index) {
Expand Down Expand Up @@ -66,7 +66,7 @@
[class.mat-calendar-body-in-preview]="_isInPreview(item.compareValue)"
[attr.aria-label]="item.ariaLabel"
[attr.aria-disabled]="!item.enabled || null"
[attr.aria-pressed]="_isSelected(item.compareValue)"
[attr.aria-selected]="_isSelected(item.compareValue)"
[attr.aria-current]="todayValue === item.compareValue ? 'date' : null"
[attr.aria-describedby]="_getDescribedby(item.compareValue)"
(click)="_cellClicked(item, $event)"
Expand Down
12 changes: 6 additions & 6 deletions src/material/datepicker/calendar-body.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ describe('MatCalendarBody', () => {
expect(selectedCell.innerHTML.trim()).toBe('4');
});

it('should set aria-pressed correctly', () => {
const pressedCells = cellEls.filter(c => c.getAttribute('aria-pressed') === 'true');
const depressedCells = cellEls.filter(c => c.getAttribute('aria-pressed') === 'false');
it('should set aria-selected correctly', () => {
const selectedCells = cellEls.filter(c => c.getAttribute('aria-selected') === 'true');
const deselectedCells = cellEls.filter(c => c.getAttribute('aria-selected') === 'false');

expect(pressedCells.length).withContext('Expected one cell to be marked as pressed.').toBe(1);
expect(depressedCells.length)
.withContext('Expected remaining cells to be marked as not pressed.')
expect(selectedCells.length).withContext('Expected one cell to be marked as selected.').toBe(1);
expect(deselectedCells.length)
.withContext('Expected remaining cells to be marked as not selected.')
.toBe(cellEls.length - 1);
});

Expand Down
2 changes: 1 addition & 1 deletion src/material/datepicker/testing/calendar-cell-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class MatCalendarCellHarness extends ComponentHarness {
/** Whether the cell is selected. */
async isSelected(): Promise<boolean> {
const host = await this.host();
return (await host.getAttribute('aria-pressed')) === 'true';
return (await host.getAttribute('aria-selected')) === 'true';
}

/** Whether the cell is disabled. */
Expand Down
Loading