Skip to content

Commit b5715b7

Browse files
committed
fixup! fix(cdk-experimental/combobox): refactor combobox filtering
1 parent adc3966 commit b5715b7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/cdk-experimental/ui-patterns/combobox/combobox.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function _type(
6868
firstMatch: WritableSignal<string | undefined>,
6969
backspace = false,
7070
) {
71+
combobox.onFocusIn();
7172
inputEl.value = text;
7273
combobox.onInput(
7374
backspace

src/cdk-experimental/ui-patterns/combobox/combobox.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ export class ComboboxPattern<T extends ListItem<V>, V> {
286286
return;
287287
}
288288

289+
// Avoid refocusing the input if a filter event occurs after focus has left the combobox.
290+
if (!this.isFocused()) {
291+
return;
292+
}
293+
289294
if (this.inputs.popupControls()?.role() === 'tree') {
290295
const treeControls = this.inputs.popupControls() as ComboboxTreeControls<T, V>;
291296
this.inputs.inputValue?.().length ? treeControls.expandAll() : treeControls.collapseAll();

0 commit comments

Comments
 (0)