ng2-ui / auto-complete

Angular Auto Complete component and directive
https://ng2-ui.github.io/dist/#/auto-complete
MIT License
279 stars 123 forks source link

Unexpected autofocus #276

Closed troolee closed 6 years ago

troolee commented 6 years ago

Hi there,

Found an unexpected behaviour. I've been using auto-complete 0.14.4 with reactive forms. In case if a field has initial value auto-complete input gets focus at startup.

Here is a plunker script that reproduces this: http://plnkr.co/edit/sFJOqsQXBEMUkGrKbhRH?p=preview

allenhwkim commented 6 years ago

This code has been recently added because users asked to set focus to the element when a new value is selected.

https://github.com/ng2-ui/auto-complete/blob/b37b8f4b3d99e6cbb3105af7ef105e1f29f6e8d3/src/auto-complete.directive.ts#L308-L315

However, as you mentioned to set focus does not seem right for initial status without user interaction. Let me see what I can do.

BTW, thanks for reporting this.

rsaenen commented 6 years ago

Hi, Same issue here, the input with auto-complete directive takes autofocus.

rsaenen commented 6 years ago

Solved with 0.13.3 release.

troolee commented 6 years ago

Oh... This doesn't solve the issue... There was no issue on 0.13.3 I assume

rsaenen commented 6 years ago

Agreed, solved wasn't the right term... Don't hesitate to contribute to this package if you could. Thanks

pablogarciamiranda commented 6 years ago

Same issue here

igorrius commented 6 years ago

Hi there. Maybe my changes will help to resolve this problem. I had create PR https://github.com/ng2-ui/auto-complete/pull/288 where I had use a new property to make this behavior more configurable.

rsaenen commented 6 years ago

Hi, I'm still having this issue... No news?

[re-focus-after-select]="false" is working.

I guess this issue can be closed :+1:

matteobaldelli commented 6 years ago

Why was it implemented only in directive and not in component??