Skip to content

Commit

Permalink
fix(material/datepicker): replace labels not pointing to anything (#2…
Browse files Browse the repository at this point in the history
…9755)

Fixes that the datepicker had some `<label>` elements that weren't pointing to anything via the `for` attribute which was being flagged by Chrome.

Fixes #29749.
  • Loading branch information
crisbeto committed Sep 18, 2024
1 parent 0ed5d7d commit 602bef1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/material/datepicker/calendar-body.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
</tr>
}

<label [id]="_startDateLabelId" class="mat-calendar-body-hidden-label">
<span [id]="_startDateLabelId" class="mat-calendar-body-hidden-label">
{{startDateAccessibleName}}
</label>
<label [id]="_endDateLabelId" class="mat-calendar-body-hidden-label">
</span>
<span [id]="_endDateLabelId" class="mat-calendar-body-hidden-label">
{{endDateAccessibleName}}
</label>
</span>
2 changes: 1 addition & 1 deletion src/material/datepicker/calendar-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- [Firefox Issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1880533]
Relocated label next to related button and made visually hidden via cdk-visually-hidden
to enable label to appear in a11y tree for SR when using Firefox -->
<label [id]="_periodButtonLabelId" class="cdk-visually-hidden" aria-live="polite">{{periodButtonDescription}}</label>
<span [id]="_periodButtonLabelId" class="cdk-visually-hidden" aria-live="polite">{{periodButtonDescription}}</span>
<button mat-button type="button" class="mat-calendar-period-button"
(click)="currentPeriodClicked()" [attr.aria-label]="periodButtonLabel"
[attr.aria-describedby]="_periodButtonLabelId">
Expand Down

0 comments on commit 602bef1

Please sign in to comment.