Highlights the currently selected item in the combobox.
()
| 219 | |
| 220 | /** Highlights the currently selected item in the combobox. */ |
| 221 | highlightEffect() { |
| 222 | const value = this.value(); |
| 223 | const inlineSuggestion = this.inlineSuggestion(); |
| 224 | |
| 225 | const isDeleting = untracked(() => this.isDeleting()); |
| 226 | const isFocused = untracked(() => this.isFocused()); |
| 227 | const isExpanded = this.isExpanded(); |
| 228 | |
| 229 | if (!inlineSuggestion || !isFocused || !isExpanded || isDeleting) return; |
| 230 | |
| 231 | const inputEl = this.element() as HTMLInputElement; |
| 232 | const isHighlightable = inlineSuggestion.toLowerCase().startsWith(value.toLowerCase()); |
| 233 | |
| 234 | if (isHighlightable) { |
| 235 | inputEl.value = value + inlineSuggestion.slice(value.length); |
| 236 | inputEl.setSelectionRange(value.length, inlineSuggestion.length); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | /** Relays keyboard events to the popup. */ |
| 241 | keyboardEventRelayEffect() { |
no test coverage detected