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

Commit 365b764

Browse files
author
piebev
committed
make sure the focus has shifted before sending the activate event, prevents losing keystrokes
1 parent 06dd75d commit 365b764

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/uiSelectController.js

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

67-
$scope.$broadcast('uis:activate');
6867

6968
ctrl.open = true;
7069

@@ -78,8 +77,12 @@ uis.controller('uiSelectCtrl',
7877

7978
// Give it time to appear before focus
8079
$timeout(function() {
81-
ctrl.search = initSearchValue || ctrl.search;
80+
if (initSearchValue) {
81+
ctrl.search = initSearchValue.val() || ctrl.search;
82+
initSearchValue.val('');
83+
}
8284
ctrl.searchInput[0].focus();
85+
$scope.$broadcast('uis:activate');
8386
});
8487
}
8588
};

src/uiSelectSingleDirective.js

Lines changed: 2 additions & 6 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
};
124-
}]);
120+
}]);

0 commit comments

Comments
 (0)