| 880 | } |
| 881 | |
| 882 | handleNavKeyPress(e: KeyboardEvent) { |
| 883 | const allItems = this._getItems(); |
| 884 | |
| 885 | if (this.focused && (isHome(e) || isEnd(e)) && this.value) { |
| 886 | return; |
| 887 | } |
| 888 | |
| 889 | const isOpen = this.open; |
| 890 | const currentItem = allItems.find(item => { |
| 891 | return item.selected || item.focused; |
| 892 | }); |
| 893 | |
| 894 | const indexOfItem = currentItem ? allItems.indexOf(currentItem) : -1; |
| 895 | e.preventDefault(); |
| 896 | |
| 897 | if (this.focused && isOpen && (isUp(e) || isPageUp(e) || isPageDown(e))) { |
| 898 | return; |
| 899 | } |
| 900 | |
| 901 | this._isKeyNavigation = true; |
| 902 | |
| 903 | if ( |
| 904 | e.key === "ArrowDown" |
| 905 | || e.key === "ArrowUp" |
| 906 | || e.key === "PageUp" |
| 907 | || e.key === "PageDown" |
| 908 | || e.key === "Home" |
| 909 | || e.key === "End" |
| 910 | ) { |
| 911 | this[`_handle${e.key}`](e, indexOfItem); |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | _handleItemNavigation(e: KeyboardEvent, indexOfItem: number, isForward: boolean) { |
| 916 | const allItems = this._getItems(); |