Gbuomprisco / ngx-chips

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

focusFirstElement attribute on TagInputDropdownComponent does not focus on first item #815

Open jfknoepfli opened 6 years ago

jfknoepfli 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 When attribute focusFirstElement="true" is set on TagInputDropdownComponent and when looking for a tag coming from an autocomplete component, the first element in the dropdown list IS NOT focused.

Expected behavior When attribute focusFirstElement="true" is set on TagInputDropdownComponent and when looking for a tag coming from an autocomplete component, the first element in the dropdown list IS focused.

Minimal reproduction of the problem with instructions (if applicable)

None of them is focused.

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

Angular version: 6.1.7

ngx-chips version: 1.9.7+ (master code eb8531a0e7822ca81b94095626468458da24cd6c)

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 ] Fedora 28 :

zsoflin commented 6 years ago

+1

bartholomej commented 5 years ago

+1

luki215 commented 5 years ago

@Gbuomprisco We have found out that if you write something, focus-out and focus-in, first item is selected.

After examination we have found out that ng2-material-dropdown loads the items from ng2-menu-item elements. These items are on first focus empty. This means that here https://github.com/Gbuomprisco/ngx-chips/blob/e91dd8d89d91c98d454de89c09b7156c1e538018/modules/components/dropdown/tag-input-dropdown.template.html#L6 the items variable must be empty in the time of first focus-in.

Don't know why, maybe this will help.

zhuweid commented 3 years ago

+1