-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Looses field focus after selecting an entry #46
Comments
A plunkr with the fix in place: http://plnkr.co/edit/B0B9kp1HesTspXo2l3jO?p=preview |
Fixes angular-ui#46. The fix does two things. First, it actively sets focus back to the button after closing the dropdown. To do this, it uses $timeout with a zero timeout value to give angular time to show the button before changing focus to it. This is the same as was done previously when showing the dropdown. There is however a second problem: bootstrap defines a transition for form_control. This means that it takes some time before the button is shown. This means that when the timeout fires and focus() is called, the button is still hidden and thus cannot be focused. To work around the second problem, we can either use a slightly longer timeout (a few 100ms), or we can disable the transitions. I have chosen to disable the transitions, since the timeout feels "ugly". This is done in the patch to select.css.
I now have a proper patch as shown above. To avoid opening one more issue, I will not open yet another pull request... |
The pull request is already closed, you need to open a new one. Anyway, it's a nice patch! The CSS also fixes the focus for activate() - open the dropdown. |
I've created a branch to experiment on this: https://github.com/angular-ui/ui-select/compare/fix-focus |
I am experiencing the same issue with angular 1.5.0 and angular-ui-select 0.14.9 although I cannot reproduce it in a basic example Any clue by any chance on which one might be likely to conflict as per past experience?
|
ui-select with the bootstrap theme does not handle focus() properly. After the user selects an entry from the dropdown by pressing Enter, keyboard focus is lost (I think that focus is moved to the element). The problem can be seen in the following plunkr:
http://plnkr.co/edit/FZ6xHJHLhmyIxLKS4mAK?p=preview
The text was updated successfully, but these errors were encountered: