Skip to content

Commit 55b74e3

Browse files
authored
fix(material-experimental/mdc-button): align public API with material/button (#20679)
Aligns the signature of the `focus` method between the MDC and non-MDC buttons to make updates easier.
1 parent c9fcbef commit 55b74e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/material-experimental/mdc-button/button-base.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
RippleAnimationConfig
2424
} from '@angular/material/core';
2525
import {numbers} from '@material/ripple';
26+
import {FocusOrigin} from '@angular/cdk/a11y';
2627

2728
/** Inputs common to all buttons. */
2829
export const MAT_BUTTON_INPUTS = ['disabled', 'disableRipple', 'color'];
@@ -119,8 +120,8 @@ export class MatButtonBase extends _MatButtonBaseMixin implements CanDisable, Ca
119120
}
120121

121122
/** Focuses the button. */
122-
focus(): void {
123-
this._elementRef.nativeElement.focus();
123+
focus(_origin: FocusOrigin = 'program', options?: FocusOptions): void {
124+
this._elementRef.nativeElement.focus(options);
124125
}
125126

126127
/** Gets whether the button has one of the given attributes. */

0 commit comments

Comments
 (0)