Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8010c7c

Browse files
fix(material/datepicker): add visible labels to calendar buttons (#31777)
Adds tooltips to the calendar next/previous buttons so that they have visible labels. Fixes #31536.
1 parent 46e1895 commit 8010c7c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

‎src/material/datepicker/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ ng_project(
180180
"//src/material/core",
181181
"//src/material/form-field",
182182
"//src/material/input",
183+
"//src/material/tooltip",
183184
],
184185
)
185186

‎src/material/datepicker/calendar-header.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121
<button matIconButton type="button" class="mat-calendar-previous-button"
2222
[disabled]="!previousEnabled()" (click)="previousClicked()"
23-
[attr.aria-label]="prevButtonLabel" disabledInteractive>
23+
[matTooltip]="prevButtonLabel" [attr.aria-label]="prevButtonLabel" disabledInteractive>
2424
<svg viewBox="0 0 24 24" focusable="false" aria-hidden="true">
2525
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
2626
</svg>
2727
</button>
2828

2929
<button matIconButton type="button" class="mat-calendar-next-button"
3030
[disabled]="!nextEnabled()" (click)="nextClicked()"
31-
[attr.aria-label]="nextButtonLabel" disabledInteractive>
31+
[matTooltip]="nextButtonLabel" [attr.aria-label]="nextButtonLabel" disabledInteractive>
3232
<svg viewBox="0 0 24 24" focusable="false" aria-hidden="true">
3333
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
3434
</svg>

‎src/material/datepicker/calendar.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {MatIconButton, MatButton} from '../button';
4343
import {_IdGenerator, CdkMonitorFocus} from '@angular/cdk/a11y';
4444
import {_CdkPrivateStyleLoader, _VisuallyHiddenLoader} from '@angular/cdk/private';
4545
import {_getFocusedElementPierceShadowDom} from '@angular/cdk/platform';
46+
import {MatTooltip} from '../tooltip';
4647

4748
/**
4849
* Possible views for the calendar.
@@ -57,7 +58,7 @@ export type MatCalendarView = 'month' | 'year' | 'multi-year';
5758
exportAs: 'matCalendarHeader',
5859
encapsulation: ViewEncapsulation.None,
5960
changeDetection: ChangeDetectionStrategy.OnPush,
60-
imports: [MatButton, MatIconButton],
61+
imports: [MatButton, MatIconButton,MatTooltip],
6162
})
6263
export class MatCalendarHeader<D> {
6364
private _intl = inject(MatDatepickerIntl);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /