Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll + hilight problem with jQuery 2.2 #2506

Closed
dmifedorenko opened this issue Jan 17, 2016 · 17 comments
Closed

Scroll + hilight problem with jQuery 2.2 #2506

dmifedorenko opened this issue Jan 17, 2016 · 17 comments

Comments

@dmifedorenko
Copy link

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:

  1. Click on chosen html item.
  2. Scroll by mouse on center of list.
  3. Move mouse under 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.

@glukash
Copy link

glukash commented Jan 19, 2016

I've noticed exactly the same issue with jQuery 2.2.

@Eric-Guo
Copy link

Same issue with jQuery 1.12.

@alxcube
Copy link

alxcube commented Jan 22, 2016

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; 

@CSI68
Copy link

CSI68 commented Jan 22, 2016

Hi all !

I've try your solution Alxcube, and it seems working !

Nice work, thx very much !

@chrisrauz
Copy link

Thanks alxcube. Works perfectly!

@eskimoe
Copy link

eskimoe commented Jan 25, 2016

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!

@dmifedorenko
Copy link
Author

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

@babelshift
Copy link

@dmifedorenko There is a workaround posted above.

@dmifedorenko
Copy link
Author

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

@babelshift
Copy link

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

@brendenwest
Copy link

@babelshift I'm with @dmifedorenko for an official fix, to avoid custom patches in an enterprise build process.

@eskimoe
Copy link

eskimoe commented Feb 9, 2016

still the same problem with chosen 1.5.0!

@tjschuck
Copy link
Member

tjschuck commented Feb 9, 2016

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

@KristofMorva
Copy link

It's a jQuery bug in 1.12.0/2.2.0, which have just been fixed by a revert: jquery/jquery@49833f7
It caused scrollTop() being added to top, that's why @alxcube's temporary fix is working.

@stof
Copy link
Collaborator

stof commented Feb 10, 2016

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

@FrDH
Copy link

FrDH commented Oct 24, 2016

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' );

@mou-k
Copy link

mou-k commented May 15, 2020

Just go to the link, download attachment and replace CHosen JS file, thats it all mobile issues solved!!

https://realize.be/blog/mobile-support-chosen

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

No branches or pull requests