Skip to content

Conversation

pfiller
Copy link
Contributor

@pfiller pfiller commented Aug 8, 2013

@harvesthq/chosen-developers

This fixes some issues in single selects that come when the data and DOM get out of sync. The trouble comes from relying on the results-selected class for tracking selected results. Since our results list now gets rebuilt with every winnow, results-selected doesn't always reflect an item that actually exists (or sometimes reflects old selections).

Two issues I saw

  • When no placeholder is present, the first item never loses its results-selected class (No placeholder results in odd behaviour #1458)
  • When deselecting a single select, the previous result stays highlighted. You can see this one in the docs pages. Click the x in the example and re-open the list. "Sloth bear" is still highlighted.

This PR fixes both of those. I still need to do some performance testing in IE8 with thousands of options, but I don't think this is going to be a problem. Looping through an array of thousands of items in IE8 is surprisingly quick.

Fixes #1458
Fixes #1391 (again)

@kenearley
Copy link

Looks good. Tested both jQuery and Prototype in Chrome, FF, and IEs. :shipit:

pfiller added a commit that referenced this pull request Aug 15, 2013
@pfiller pfiller merged commit 5eac8bc into master Aug 15, 2013
@pfiller pfiller deleted the g1458-fix-single-selected-result branch August 15, 2013 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No placeholder results in odd behaviour Single select and disable_search_threshold is enabled - not deselecting items correctly
2 participants