Skip to content
This repository was 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
rpocklin wants to merge 1 commit into
angular-ui:masterfrom
rpocklin:remove-flicker-on-search-but-preserve-when-dropdown-not-shown
Closed

rpocklin wants to merge 1 commit into
angular-ui:masterfrom
rpocklin:remove-flicker-on-search-but-preserve-when-dropdown-not-shown

Conversation

@rpocklin

@rpocklin rpocklin commented May 9, 2016

Copy link
Copy Markdown
Contributor

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

@aaronrenner

Copy link
Copy Markdown

Works for me 👍

Comment thread src/uiSelectDirective.js
// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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
Copy Markdown

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