()
| 847 | } |
| 848 | |
| 849 | _adjustSelectionRange() { |
| 850 | const innerInput = this.getInputDOMRefSync()!; |
| 851 | const visibleItems = this.Suggestions?._getItems().filter(item => !item.hidden) as IInputSuggestionItemSelectable[]; |
| 852 | const currentItem = visibleItems?.find(item => { return item.selected || item.focused; }); |
| 853 | const groupItems = this._flattenItems.filter(item => this._isGroupItem(item)); |
| 854 | |
| 855 | if (currentItem && !groupItems.includes(currentItem)) { |
| 856 | const doesItemStartWithTypedValue = currentItem?.text?.toLowerCase().startsWith(this.typedInValue.toLowerCase()); |
| 857 | if (doesItemStartWithTypedValue) { |
| 858 | innerInput.setSelectionRange(this.typedInValue.length, this.value.length); |
| 859 | } else { |
| 860 | innerInput.setSelectionRange(0, this.value.length); |
| 861 | } |
| 862 | } else { |
| 863 | // No current item selected (e.g., during typing) - use default typeahead selection |
| 864 | innerInput.setSelectionRange(this.typedInValue.length, this.value.length); |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | _onkeydown(e: KeyboardEvent) { |
| 869 | this._isKeyNavigation = true; |
no test coverage detected