(e: KeyboardEvent)
| 860 | } |
| 861 | |
| 862 | _handleArrowNavigation(e: KeyboardEvent) { |
| 863 | e.preventDefault(); |
| 864 | |
| 865 | if (this.readonly) { |
| 866 | return; |
| 867 | } |
| 868 | |
| 869 | let nextIndex = -1; |
| 870 | const currentIndex = this._selectedIndex; |
| 871 | const isDownKey = isDown(e); |
| 872 | |
| 873 | if (isDownKey) { |
| 874 | nextIndex = this._getNextOptionIndex(); |
| 875 | } else { |
| 876 | nextIndex = this._getPreviousOptionIndex(); |
| 877 | } |
| 878 | |
| 879 | this._changeSelectedItem(this._selectedIndex, nextIndex); |
| 880 | |
| 881 | if (currentIndex !== this._selectedIndex) { |
| 882 | // Announce new item even if picker is opened. |
| 883 | // The aria-activedescendents attribute can't be used, |
| 884 | // because listitem elements are in different shadow dom |
| 885 | this.itemSelectionAnnounce(); |
| 886 | this._scrollSelectedItem(); |
| 887 | } |
| 888 | } |
| 889 | |
| 890 | _changeSelectedItem(oldIndex: number, newIndex: number) { |
| 891 | const options: Array<IOption> = this.options; |
no test coverage detected