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

Commit 81c33d0

Browse files
rpocklinuser378230
authored andcommitted
fix(uiSelect): remove flicker on search change
Removes flicker caused when changing the search string whilst still preserving the original hiding when dropdown is not visible. Fixes #1298 and closes #1594 Closes #1557 (Supersedes)
1 parent 1770038 commit 81c33d0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: src/uiSelectDirective.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ uis.directive('uiSelect',
360360
});
361361
};
362362

363+
var opened = false;
364+
363365
scope.calculateDropdownPos = function() {
364366
if ($select.open) {
365367
dropdown = angular.element(element).querySelectorAll('.ui-select-dropdown');
@@ -368,8 +370,11 @@ uis.directive('uiSelect',
368370
return;
369371
}
370372

371-
// Hide the dropdown so there is no flicker until $timeout is done executing.
372-
dropdown[0].style.opacity = 0;
373+
// Hide the dropdown so there is no flicker until $timeout is done executing.
374+
if ($select.search === '' && !opened) {
375+
dropdown[0].style.opacity = 0;
376+
opened = true;
377+
}
373378

374379
if (!uisOffset(dropdown).height && $select.$animate && $select.$animate.on && $select.$animate.enabled(dropdown)) {
375380
var needsCalculated = true;

0 commit comments

Comments
 (0)