-
Notifications
You must be signed in to change notification settings - Fork 1.8k
on focus not working for first click #1253
Comments
Same problem here but for single select. |
I am seeing a very similar issue. Running the latest version of angular-ui-select with angular 1.3.16 was working fine. However, after updating to angular 1.4.5, this issue started occurring. My issue differs slightly...when clicking the select the first time without any value set, the input gains focus. However, if the select already has a value or I click it a second time, the input never gains focus again until I click inside the input field or outside the select field, both of which cause the select to close. |
I think I found the issue....if I remove angular-animate 1.4.5 or 1.4.7, it works just fine. |
I just found another report of my problem and the fix: #859 (comment). --edit-- Never mind, the issue @ramprakash-ravi describes is caused when using angular 1.4.4. |
Added support for ngAnimate by waiting for animations to complete before focusing on the search input field. This uses $injector to get a reference to $animate so that the project is not dependent upon ngAnimate. Check plunkr http://plnkr.co/edit/G02EbD for a working example. This should resolve issues with ngAnimate 1.4.4 and 1.4.5. This should cover the following issues: angular-ui#859 angular-ui#1253
Input field is still not getting focus on first click when using ui-select 0.14.9, angular 1.4.5. I hacked around this by turning off ALL animations when setting the input focus:
|
I can not longer reproduce this issue. My plunker is here. Maybe you can fork it and modify it to your setup. If you are still having the issue, post the plunker back to me and I can take a look. |
Could not instantly reproduce the problem either in the plunker. Will try again later. |
Not focusing on first click. Reproduceble Plunker |
@joonask The problem is that you have no items to list out. Thats not to say this is not an issue with the library. However, given that no search value has been entered, users may expect an initial list of values. Try adding the below to the top of your search function.
|
Corrected input focus when ui-select contains no elements. Also corrected a memory leaked caused by event handlers never being removed. Closes angular-ui#1253
@patrickhousley, we are using ui-select as a search box, so when the user types something, a backend search call gets made and results are shown. So initially the list of values is always empty. Good catch on the event leak in your fix. |
When ui-select is loaded in the page for the first time, it is disabled by default.
But after focusing on other input boxes and focusing on the ui-select it is working as expected.
My HTML:
<ui-select multiple ng-model="newMachine.machine_devices"> <ui-select-match> {{$item.Esn}} </ui-select-match> <ui-select-choices repeat="device in devices | filter:$select.search"> {{device.Esn}} </ui-select-choices> </ui-select>
js:
$scope.devices = [{DeviceID:1,Esn:'SCE112514000145182'},{DeviceID:2,Esn:'SCE112514000145185'}]
The text was updated successfully, but these errors were encountered: