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

Remove flicker on search but preserve original hide when dropdown not visible #1594

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/uiSelectDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ uis.directive('uiSelect',

};

var opened = false;

scope.calculateDropdownPos = function(){

if ($select.open) {
Expand All @@ -331,8 +333,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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpocklin Does opened never need to be reset to false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that i've found, since it's already been rendered once - AFAIK the opacity change was for the initial render only.

}

// Delay positioning the dropdown until all choices have been added so its height is correct.
$timeout(function(){
Expand Down