Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Adding filter and supporting up/down arrows #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Adding filter and supporting up/down arrows #5

wants to merge 1 commit into from

Conversation

caiovlp
Copy link

@caiovlp caiovlp commented Aug 5, 2019

Adding filter to quickly search by name and supporting arrows + enter to select item you want more easily

@caiovlp caiovlp mentioned this pull request Aug 5, 2019
@Eugeny
Copy link
Owner

Eugeny commented Aug 8, 2019

Thank you for the PR!

It looks like the 0-9 shortcuts are broken since the list is filtered first, and the index is only checked after that.

@HostListener(`document:keyup`, ['$event']) onKey ($event: KeyboardEvent) {
if ($event.key >= '0' && $event.key <= '9') {
let index = $event.key.charCodeAt(0) - '0'.charCodeAt(0)
this.modalInstance.close(this.items[index])
if (index < this.filteredItems.length) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never happens since the list is always empty after typing a digit in to the filter box

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants