diff --git a/src/cdk/stepper/stepper.ts b/src/cdk/stepper/stepper.ts index 9bb879647d7e..31242d557228 100644 --- a/src/cdk/stepper/stepper.ts +++ b/src/cdk/stepper/stepper.ts @@ -109,9 +109,12 @@ export class CdkStepper { @Input() get selectedIndex() { return this._selectedIndex; } set selectedIndex(index: number) { - if (this._selectedIndex != index && !this._anyControlsInvalid(index)) { + if (this._anyControlsInvalid(index)) { + // remove focus from clicked step header if the step is not able to be selected + this._stepHeader.toArray()[index].nativeElement.blur(); + } else if (this._selectedIndex != index) { this._emitStepperSelectionEvent(index); - this._focusStep(this._selectedIndex); + this._focusIndex = this._selectedIndex; } } private _selectedIndex: number = 0; diff --git a/src/lib/stepper/_stepper-theme.scss b/src/lib/stepper/_stepper-theme.scss index 4f72d6ab0f48..d61eb4715996 100644 --- a/src/lib/stepper/_stepper-theme.scss +++ b/src/lib/stepper/_stepper-theme.scss @@ -9,6 +9,11 @@ .mat-horizontal-stepper-header, .mat-vertical-stepper-header { + &:focus, + &:hover { + background-color: mat-color($background, hover); + } + .mat-stepper-label { color: mat-color($foreground, text); } @@ -33,11 +38,11 @@ background-color: mat-color($background, card); } - .mat-vertical-content-container { + .mat-stepper-vertical-line::before { border-left-color: mat-color($foreground, divider); } - .mat-connector-line { + .mat-stepper-horizontal-line { border-top-color: mat-color($foreground, divider); } } diff --git a/src/lib/stepper/stepper-horizontal.html b/src/lib/stepper/stepper-horizontal.html index 0eade60c9f35..6472a981ff9b 100644 --- a/src/lib/stepper/stepper-horizontal.html +++ b/src/lib/stepper/stepper-horizontal.html @@ -21,7 +21,7 @@ -
+