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

refactor(choices): avoid setting activeItem on mouseenter #1211

Merged
merged 2 commits into from
Sep 29, 2015

Conversation

dimirc
Copy link
Contributor

@dimirc dimirc commented Sep 28, 2015

We were using ng-mouseenter to be able to set the hovered row as the active item, but this caused some lagging as ng-mouseenter was calling for a full $digest.

Could be better just to show a simple hover background change (using css) and avoid doing a $digest.

Demo plunker

@@ -17,6 +17,11 @@
top: 0px !important;
}


.ui-select-choices-row:hover{
Copy link

Choose a reason for hiding this comment

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

code consistency: add space before {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jtheoof done

@jtheoof
Copy link

jtheoof commented Sep 28, 2015

I might be wrong, but after a quick git-grep it looks like the only place where setActiveItem was being called was from the ng-mouseenter event. Perhaps we can get rid of it in uiSelectController.js.

@dimirc
Copy link
Contributor Author

dimirc commented Sep 28, 2015

@jtheoof yes, its not needed anymore. I just removed it

@jtheoof
Copy link

jtheoof commented Sep 28, 2015

👍 Not sure what went wrong with the build.

@dimirc
Copy link
Contributor Author

dimirc commented Sep 28, 2015

Y just rebuilt it and Travis is fine now

@jtheoof
Copy link

jtheoof commented Sep 28, 2015

Cool, I think it's good to go. Might help #88 but I do not think it's the main performance issue.

dimirc added a commit that referenced this pull request Sep 29, 2015
refactor(choices): avoid setting activeItem on mouseenter
@dimirc dimirc merged commit f6b6d81 into master Sep 29, 2015
@dimirc dimirc deleted the feat-choices-hover-css branch September 29, 2015 17:19
user378230 pushed a commit to user378230/ui-select that referenced this pull request Mar 25, 2016
setActiveItem was removed as part of PR angular-ui#1211 but not all calls to the
function were.
@sonphnt
Copy link

sonphnt commented Oct 3, 2016

Hi,

When my ng-model is null at first with placeholder "Please select". Do we have any option to turn off active blue background on the first item of the list. Because that make people confused when user click to open the dropdown and see the first item selected with blue background.

The blue background on item should only be highlighted if ng-model has value when user select one item. Otherwise, we should leave all items in the dropdown list with white background as normal.

Thanks

@kryptografisch
Copy link

+1

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