MCPcopy
hub / github.com/angular/components / highlightEffect

Method highlightEffect

src/aria/private/combobox/combobox.ts:211–228  ·  view source on GitHub ↗

Highlights the currently selected item in the combobox.

()

Source from the content-addressed store, hash-verified

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() {

Callers 2

constructorMethod · 0.80
combobox.spec.tsFile · 0.80

Calls 4

isFocusedMethod · 0.65
isExpandedMethod · 0.65
valueMethod · 0.45
elementMethod · 0.45

Tested by

no test coverage detected