Hello.
Chosen 1.4.2 not work with jQuery 2.2. Check out two examples:
https://jsfiddle.net/oLyfgt7m/1/
https://jsfiddle.net/oLyfgt7m/2/
On both examples try to select item on middle of list:
With jQuery 2.1.4 all work fine, but with 2.2 I cant select right item, scroll of chosen allways go down.
Looks like some bug insade hilight method.
This issue is hight priority for me, I cant upgrade to jQuery 2.2. Thank you.
I've noticed exactly the same issue with jQuery 2.2.
Same issue with jQuery 1.12.
hi guys! looks like i've solved this issue
Thereis following code on line 855 in not minified version:
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
i've removed scrollTop and it heleped:
high_top = this.result_highlight.position().top;
Hi all !
I've try your solution Alxcube, and it seems working !
Nice work, thx very much !
Thanks alxcube. Works perfectly!
same bug here, it seems they changed a lot with scrollTop() in 2.2 and 1.12, something to do with tests on different browsers..
please provide an official fix :) thx for this great plugin!
@tjschuck is where any chance you will fix this bug soon? I really need jQuery 2.2 in my project and I cant migrate because of this issue.
@dmifedorenko There is a workaround posted above.
@babelshift really? :)
What can I do with this workaround? Patch my local chosen copy? Fork chosen on github and rebase master every time after new chosen release out? Was this workaround tested in all popular browsers?
Chosen is one of about 15 js libraries used in our project. Our company prefer use official releases of minor libraries and not fork or patch when. I will better migrate to select2 for example.
@dmifedorenko Workarounds are a temporary fix until the official repo releases the real thing. Chosen is not a frequently released library. In fact, the last major release was nearly a year ago. As such, you will not be required to rebase and retest for any great amount of time.
Regardless, migrating to an entirely different library seems like a much larger effort than simply patching a single line in the mean time.
@babelshift I'm with @dmifedorenko for an official fix, to avoid custom patches in an enterprise build process.
still the same problem with chosen 1.5.0!
@eskimoe There was no fix included in 1.5.0 because no fix has been submitted. This is just an issue, not a pull request. If someone submits a pull request with a fix that works across all the supported versions of jQuery, it will be merged and included in the next release.
It's a jQuery bug in 1.12.0/2.2.0, which have just been fixed by a revert: jquery/jquery@49833f7795d665ff1d543c4f71f29fca95b567e9
It caused scrollTop() being added to top, that's why @alxcube's temporary fix is working.
I'm closing the issue as the jQuery bug has been fixed. so the fix will be to update to jQuery 2.2.1 when it is released
Had the same (or a similar) issue with jquery 2.2.4 and chosen 1.6.2.
Fixed it by removing the DOMMouseScroll event from the scrollable list:
$('select').chosen();
$('.chosen-results').off( 'DOMMouseScroll' );
Most helpful comment
hi guys! looks like i've solved this issue
Thereis following code on line 855 in not minified version:
i've removed scrollTop and it heleped: