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