(e: KeyboardEvent, indexOfItem: number, isForward: boolean)
| 913 | } |
| 914 | |
| 915 | _handleItemNavigation(e: KeyboardEvent, indexOfItem: number, isForward: boolean) { |
| 916 | const allItems = this._getItems(); |
| 917 | |
| 918 | const currentItem: IComboBoxItem = allItems[indexOfItem]; |
| 919 | const isGroupItem = currentItem && currentItem.isGroupItem; |
| 920 | const nextItem = isForward ? allItems[indexOfItem + 1] : allItems[indexOfItem - 1]; |
| 921 | |
| 922 | if ((!this.open) && ((isGroupItem && !nextItem) || (!isGroupItem && !currentItem))) { |
| 923 | return; |
| 924 | } |
| 925 | |
| 926 | this._clearFocus(); |
| 927 | |
| 928 | if (this.open) { |
| 929 | this._itemFocused = true; |
| 930 | this.value = isGroupItem ? "" : currentItem.text!; |
| 931 | this.selectedValue = isGroupItem ? undefined : currentItem.value; |
| 932 | this.focused = false; |
| 933 | |
| 934 | currentItem.focused = true; |
| 935 | } else { |
| 936 | this.focused = true; |
| 937 | this.value = isGroupItem ? nextItem.text! : currentItem.text!; |
| 938 | this.selectedValue = currentItem.value; |
| 939 | currentItem.focused = false; |
| 940 | } |
| 941 | |
| 942 | this._announceSelectedItem(indexOfItem); |
| 943 | this._scrollToItem(indexOfItem); |
| 944 | |
| 945 | if (isGroupItem && this.open) { |
| 946 | return; |
| 947 | } |
| 948 | // autocomplete |
| 949 | this._handleTypeAhead(this.value, this.open ? this._userTypedValue : ""); |
| 950 | |
| 951 | this.fireDecoratorEvent("input"); |
| 952 | } |
| 953 | |
| 954 | _handleTypeAhead(value: string, filterValue: string) { |
| 955 | const item = this._getFirstMatchingItem(value); |
no test coverage detected