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

Commit

Permalink
fix(uiSelect): remove flicker on search change
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
rpocklin authored and user378230 committed Jul 16, 2016
1 parent 1770038 commit 81c33d0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/uiSelectDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ uis.directive('uiSelect',
});
};

var opened = false;

scope.calculateDropdownPos = function() {
if ($select.open) {
dropdown = angular.element(element).querySelectorAll('.ui-select-dropdown');
Expand All @@ -368,8 +370,11 @@ uis.directive('uiSelect',
return;
}

// Hide the dropdown so there is no flicker until $timeout is done executing.
dropdown[0].style.opacity = 0;
// Hide the dropdown so there is no flicker until $timeout is done executing.
if ($select.search === '' && !opened) {
dropdown[0].style.opacity = 0;
opened = true;
}

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

0 comments on commit 81c33d0

Please sign in to comment.