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

Commit b4787ba

Browse files
committed
fix(ui-select): avoid dropdown flickering on search
setting the opacity to 0 on each call to calculateDropdownPos brought the dropdown to flicker when you typed a search text. Now it is only doing this on initially opening the dropdown which avoids a flickering on the opening effect.
1 parent fe0c0c1 commit b4787ba

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: src/uiSelectDirective.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,13 @@ uis.directive('uiSelect',
295295
scope.$watch('$select.open', function() {
296296

297297
if ($select.dropdownPosition === 'auto' || $select.dropdownPosition === 'up'){
298+
// Hide the dropdown to avoid flickering on initial opening
299+
dropdown = angular.element(element).querySelectorAll('.ui-select-dropdown');
300+
301+
if (dropdown.length > 0) {
302+
dropdown[0].style.opacity = 0;
303+
}
304+
298305
scope.calculateDropdownPos();
299306
}
300307

@@ -331,9 +338,6 @@ uis.directive('uiSelect',
331338
return;
332339
}
333340

334-
// Hide the dropdown so there is no flicker until $timeout is done executing.
335-
dropdown[0].style.opacity = 0;
336-
337341
// Delay positioning the dropdown until all choices have been added so its height is correct.
338342
$timeout(function(){
339343

0 commit comments

Comments
 (0)