Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 6cba568

Browse files
author
piebev
committed
make sure the focus has shifted before sending the activate event, prevents losing keystrokes
1 parent 6766754 commit 6cba568

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/uiSelectController.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ uis.controller('uiSelectCtrl',
111111
if (!ctrl.disabled && !ctrl.open) {
112112
if(!avoidReset) _resetSearchInput();
113113

114-
$scope.$broadcast('uis:activate');
115114

116115
ctrl.open = true;
117116

@@ -163,8 +162,12 @@ uis.controller('uiSelectCtrl',
163162
};
164163

165164
ctrl.focusSearchInput = function (initSearchValue) {
166-
ctrl.search = initSearchValue || ctrl.search;
165+
if (initSearchValue) {
166+
ctrl.search = initSearchValue.val() || ctrl.search;
167+
initSearchValue.val('');
168+
}
167169
ctrl.searchInput[0].focus();
170+
$scope.$broadcast('uis:activate');
168171
};
169172

170173
ctrl.findGroupByName = function(name) {

src/uiSelectSingleDirective.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,9 @@ uis.directive('uiSelectSingle', ['$timeout','$compile', function($timeout, $comp
112112
return;
113113
}
114114

115-
$select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input
116-
focusser.val('');
115+
$select.activate(focusser); //User pressed some regular key, so we pass it to the search input
117116
scope.$digest();
118-
119117
});
120-
121-
122118
}
123119
};
124120
}]);

0 commit comments

Comments
 (0)