Skip to content

Commit 2ceb536

Browse files
committed
refactor(material/timepicker): adds check for aria-labelledby for override
Updates previous fix which implements a default aria-label if no custom aria-label is provided to where it checks if an aria-lablledby value is provided and uses the aria-labelledby value if available. If not it will check for a custom aria-label and if that is not provided it will default to the generic aria-label value.
1 parent fd5f7ab commit 2ceb536

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/material/timepicker/timepicker-toggle.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,10 @@ export class MatTimepickerToggle<D> {
9494
}
9595

9696
/**
97-
* Gets the aria-label to use for the toggle button.
98-
* Returns the user-provided aria-label if one exists,
99-
* otherwise returns the default aria-label using the timepicker's panelId.
97+
* Checks for ariaLabelledby and if empty uses custom
98+
* aria-label or defaultAriaLabel if neither is provided.
10099
*/
101-
getAriaLabel(): string {
102-
return this.ariaLabel() || this._defaultAriaLabel;
100+
getAriaLabel(): string | null {
101+
return this.ariaLabelledby() ? null : this.ariaLabel() || this._defaultAriaLabel;
103102
}
104103
}

tools/public_api_guard/material/timepicker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class MatTimepickerToggle<D> {
127127
readonly ariaLabelledby: InputSignal<string | undefined>;
128128
readonly disabled: InputSignalWithTransform<boolean, unknown>;
129129
readonly disableRipple: InputSignalWithTransform<boolean, unknown>;
130-
getAriaLabel(): string;
130+
getAriaLabel(): string | null;
131131
// (undocumented)
132132
protected _isDisabled: Signal<boolean>;
133133
protected _open(event: Event): void;

0 commit comments

Comments
 (0)