ui-select
ui-select copied to clipboard
Defferent behaviuor of caret in multiple version with append-to-body
If I turn append-to-body on in multiple version after selecting item with enter caret is not in field - I have to click fiels once again to focus.
With append-to-body off everything is ok
+1
It happens because the element is replaced on focus out
Look at my pull request, maybe it is not good way to solve, but it works https://github.com/angular-ui/ui-select/pull/1142
Can you post a reproduction in Plunker?
Monky-patching for now with a sibling directive to "ui-select":
'use strict';
angular.module('x').directive("uiSelectFocusPatch", function ($timeout) {
// https://github.com/angular-ui/ui-select/issues/1039
function link(scope, element, attrs) {
scope.$watch('$select.open', function () {
$timeout(function () {
scope.$select.setFocus();
});
});
}
return {
restrict: "A",
require: ['uiSelect'],
scope: true,
link: link
};
});
Please note the $timeout service. The fix for #1003 does not seem to work for me.
How about this?
<ui-select on-select="$select.setFocus()" ... </ui-select>