Skip to content

Commit ff03def

Browse files
fix(simple-combo): resolve filtering on keydown when dropdown is closed
1 parent da0d509 commit ff03def

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -327,23 +327,29 @@ export class IgxSimpleComboComponent extends IgxComboBaseDirective implements Co
327327
// manually trigger text selection as it will not be triggered during editing
328328
this.textSelection.trigger();
329329
return;
330-
} else if (event.key === this.platformUtil.KEYMAP.BACKSPACE
330+
}
331+
if (event.key === this.platformUtil.KEYMAP.BACKSPACE
331332
|| event.key === this.platformUtil.KEYMAP.DELETE) {
332333
this._updateInput = false;
333334
this.clearSelection(true);
334-
} else if (event.key === this.platformUtil.KEYMAP.TAB) {
335+
}
336+
if (!this.collapsed && event.key === this.platformUtil.KEYMAP.TAB) {
335337
this.clearOnBlur();
336338
this.close();
337-
} else {
338-
if (event.key !== this.platformUtil.KEYMAP.ARROW_DOWN && event.key !== this.platformUtil.KEYMAP.SPACE) {
339-
const newFilterValue = this.filterValue + event.key.toLowerCase();
340-
this.filterValue = newFilterValue;
341-
this.searchValue = newFilterValue;
342-
this.filteredData = this.data.filter(item => this.findAllMatches(item));
343-
if (this.filteredData.length > 0 && this.collapsed) {
344-
this.open();
345-
}
346-
}
339+
}
340+
if (this.collapsed && event.key && event.key.length > 0
341+
&& event.key !== this.platformUtil.KEYMAP.CONTROL && !event.altKey && !event.metaKey) {
342+
const newFilterValue = this.filterValue + event.key.toLowerCase();
343+
this.filterValue = newFilterValue;
344+
this.searchValue = newFilterValue;
345+
this.filteredData = this.data.filter(item => this.findAllMatches(item));
346+
this.open();
347+
}
348+
if (event.key === this.platformUtil.KEYMAP.SPACE && this.filteredData.length !== this.data.length) {
349+
this.clearSelection();
350+
this.filterValue = '';
351+
this.searchValue = '';
352+
this.filteredData = this.data;
347353
}
348354
this.composing = false;
349355
super.handleKeyDown(event);

0 commit comments

Comments
 (0)