@@ -179,9 +179,7 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
179179 if ( this . _selectedIndex != index &&
180180 ! this . _anyControlsInvalidOrPending ( index ) &&
181181 ( index >= this . _selectedIndex || this . _steps . toArray ( ) [ index ] . editable ) ) {
182-
183- this . _emitStepperSelectionEvent ( index ) ;
184- this . _keyManager . updateActiveItemIndex ( this . _selectedIndex ) ;
182+ this . _updateSelectedItemIndex ( index ) ;
185183 }
186184 } else {
187185 this . _selectedIndex = index ;
@@ -237,7 +235,7 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
237235
238236 /** Resets the stepper to its initial state. Note that this includes clearing form data. */
239237 reset ( ) : void {
240- this . selectedIndex = 0 ;
238+ this . _updateSelectedItemIndex ( 0 ) ;
241239 this . _steps . forEach ( step => step . reset ( ) ) ;
242240 this . _stateChanged ( ) ;
243241 }
@@ -283,14 +281,15 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
283281 return this . _keyManager ? this . _keyManager . activeItemIndex : this . _selectedIndex ;
284282 }
285283
286- private _emitStepperSelectionEvent ( newIndex : number ) : void {
284+ private _updateSelectedItemIndex ( newIndex : number ) : void {
287285 const stepsArray = this . _steps . toArray ( ) ;
288286 this . selectionChange . emit ( {
289287 selectedIndex : newIndex ,
290288 previouslySelectedIndex : this . _selectedIndex ,
291289 selectedStep : stepsArray [ newIndex ] ,
292290 previouslySelectedStep : stepsArray [ this . _selectedIndex ] ,
293291 } ) ;
292+ this . _keyManager . updateActiveItemIndex ( newIndex ) ;
294293 this . _selectedIndex = newIndex ;
295294 this . _stateChanged ( ) ;
296295 }
0 commit comments