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

Conversation

rpocklin
Copy link
Contributor

@rpocklin rpocklin commented May 9, 2016

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

@aaronrenner
Copy link

Works for me 👍

// 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.

@Yurko-Fedoriv
Copy link

@rpocklin thanks for the fix, it's very helpful, I ported it to my fork, since I need to integrate it, and I'm having one note:
you are defining opened in the top most global scope, which is not very cool. Here is my version, it probably has slightly better code smell:

https://github.com/nutritionix/ui-select/blob/f20c4d45feb2f21701bd579b19c9a90c672994e6/src/uiSelectDirective.js#L373-L376

@rpocklin
Copy link
Contributor Author

@Yurko-Fedoriv not sure you know what you're doing here. You're adding a variable under a function declaration. My version is not using global scope, its within the directive in the compile function. It can only be initially opened once anyway, so it's fine in this case.

@Yurko-Fedoriv
Copy link

ah, sorry, nvm, I somehow missed outer declaration.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants