Skip to content

Commit 54b9140

Browse files
committed
fix(stepper): Fix visual flake in focusing stepper header
When the step is changed through a button click sometimes the focus of the new step header is attributed by focus monitor to 'mouse' instead of 'program'. This results in a visual difference in the step header (focus background is missing). Instead, when focusing the step header focus it via 'program' explicitly through the focus monitor.
1 parent b7f064b commit 54b9140

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/stepper/step-header.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ export class MatStepHeader extends CdkStepHeader implements OnDestroy {
8181
this._focusMonitor.stopMonitoring(this._elementRef);
8282
}
8383

84+
/** Focuses the step header. */
85+
focus() {
86+
this._focusMonitor.focusVia(this._elementRef, 'program');
87+
}
88+
8489
/** Returns string label of given step if it is a text label. */
8590
_stringLabel(): string | null {
8691
return this.label instanceof MatStepLabel ? null : this.label;

0 commit comments

Comments
 (0)