Skip to content

Commit

Permalink
SelectableListBoxDropdown: add keyboard navigation #2612
Browse files Browse the repository at this point in the history
-aligned behaviour with combobox
  • Loading branch information
ashklianko committed Jun 6, 2022
1 parent cca9574 commit f058667
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {DropdownHandle} from '../../button/DropdownHandle';
import {DivEl} from '../../../dom/DivEl';
import {Element} from '../../../dom/Element';
import {ValueChangedEvent} from '../../../ValueChangedEvent';
import {KeyHelper} from '../../KeyHelper';

export interface ListBoxDropdownOptions<I> {
filter?: (item: I, searchString: string) => boolean;
Expand Down Expand Up @@ -58,6 +59,12 @@ export class ListBoxDropdown<I> extends DivEl {
});
}
});

this.optionFilterInput.onKeyDown((event: KeyboardEvent) => {
if (!this.listBox.isVisible() && KeyHelper.isArrowDownKey(event)) {
this.listBox.setVisible(true);
}
});
}

protected filterItem(item: I, searchString: string): void {
Expand Down
Loading

0 comments on commit f058667

Please sign in to comment.