Gbuomprisco / ngx-chips

Tag Input component for Angular
MIT License
902 stars 359 forks source link

First item in filtered list is not selected when pressing enter #683

Open trashhead opened 6 years ago

trashhead commented 6 years ago

PLEASE MAKE SURE THAT:

I'm submitting a ... (check one with "x")

[ x] bug report => search github for a similar issue or PR before submitting
[ ] support request/question

Notice: feature requests will be ignored, submit a PR if you'd like

Current behavior

I'm using [focusFirstElement]="true". If using autocomplete and typing a valid option in the dropdown and pressing enter. It will pick the first option in the unfiltered list instead following the instructions:

Type "k" wait until list appears('Alkohol' will be first), continue to write "okain" (so the full Word is 'kokain') press enter. "Alkohol" will be selecteddespite 'Kokain' is the only option in the list.

https://stackblitz.com/edit/angular-our28q?file=app%2Fapp.component.html

Expected behavior

If kokain is the only option in the list it should be selected when pressing enter, not a previously option that has been first in the list.

Minimal reproduction of the problem with instructions (if applicable)

Type "k" wait until list appears('Alkohol' will be first), continue to write "okain" (so the full Word is 'kokain') press enter. "Alkohol" will be selecteddespite 'Kokain' is the only option in the list.

https://stackblitz.com/edit/angular-our28q?file=app%2Fapp.component.html

What do you use to build your app?. Please specify the version

Angular version:

"@angular/core": "^5.2.2"

ngx-chips version:

"ngx-chips": "^1.6.3-rc.3"

Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

Chrome Edge Ie11

na-le commented 6 years ago

+1

ofir-hamer commented 6 years ago

+1

Gbuomprisco commented 6 years ago

@trashhead @na-le @ofir-hamer Can you try the latest version?