(newIndex: number)
| 547 | } |
| 548 | |
| 549 | private _updateSelectedItemIndex(newIndex: number): void { |
| 550 | const stepsArray = this.steps.toArray(); |
| 551 | const selectedIndex = this._selectedIndex(); |
| 552 | |
| 553 | this.selectionChange.emit({ |
| 554 | selectedIndex: newIndex, |
| 555 | previouslySelectedIndex: selectedIndex, |
| 556 | selectedStep: stepsArray[newIndex], |
| 557 | previouslySelectedStep: stepsArray[selectedIndex], |
| 558 | }); |
| 559 | |
| 560 | // If focus is inside the stepper, move it to the next header, otherwise it may become |
| 561 | // lost when the active step content is hidden. We can't be more granular with the check |
| 562 | // (e.g. checking whether focus is inside the active step), because we don't have a |
| 563 | // reference to the elements that are rendering out the content. |
| 564 | if (this._keyManager) { |
| 565 | this._containsFocus() |
| 566 | ? this._keyManager.setActiveItem(newIndex) |
| 567 | : this._keyManager.updateActiveItem(newIndex); |
| 568 | } |
| 569 | |
| 570 | this._selectedIndex.set(newIndex); |
| 571 | this.selectedIndexChange.emit(newIndex); |
| 572 | this._stateChanged(); |
| 573 | } |
| 574 | |
| 575 | _onKeydown(event: KeyboardEvent) { |
| 576 | const hasModifier = hasModifierKey(event); |
no test coverage detected