fix(stepper): Fix visual flake in focusing stepper header (#15870)

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.
This commit is contained in:
Mitchell Wills
2019-04-25 09:42:54 -07:00
committed by mmalerba
parent d1366ba2b0
commit 8b5c0f12c8
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -81,6 +81,11 @@ export class MatStepHeader extends CdkStepHeader implements OnDestroy {
this._focusMonitor.stopMonitoring(this._elementRef);
}
/** Focuses the step header. */
focus() {
this._focusMonitor.focusVia(this._elementRef, 'program');
}
/** Returns string label of given step if it is a text label. */
_stringLabel(): string | null {
return this.label instanceof MatStepLabel ? null : this.label;
+1
View File
@@ -35,6 +35,7 @@ export declare class MatStepHeader extends CdkStepHeader implements OnDestroy {
_getIconContext(): MatStepperIconContext;
_stringLabel(): string | null;
_templateLabel(): MatStepLabel | null;
focus(): void;
ngOnDestroy(): void;
}