Highlights the currently selected item in the combobox.
()
| 209 | |
| 210 | /** Highlights the currently selected item in the combobox. */ |
| 211 | highlightEffect() { |
| 212 | const value = this.value(); |
| 213 | const inlineSuggestion = this.inlineSuggestion(); |
| 214 | |
| 215 | const isDeleting = untracked(() => this.isDeleting()); |
| 216 | const isFocused = untracked(() => this.isFocused()); |
| 217 | const isExpanded = this.isExpanded(); |
| 218 | |
| 219 | if (!inlineSuggestion || !isFocused || !isExpanded || isDeleting) return; |
| 220 | |
| 221 | const inputEl = this.element() as HTMLInputElement; |
| 222 | const isHighlightable = inlineSuggestion.toLowerCase().startsWith(value.toLowerCase()); |
| 223 | |
| 224 | if (isHighlightable) { |
| 225 | inputEl.value = value + inlineSuggestion.slice(value.length); |
| 226 | inputEl.setSelectionRange(value.length, inlineSuggestion.length); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | /** Relays keyboard events to the popup. */ |
| 231 | keyboardEventRelayEffect() { |
no test coverage detected