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

Up arrow generates JS error #3523

Closed
Karmalakas opened this issue Jun 25, 2015 · 5 comments
Closed

Up arrow generates JS error #3523

Karmalakas opened this issue Jun 25, 2015 · 5 comments

Comments

@Karmalakas
Copy link
Contributor

https://jsfiddle.net/urkaj76k/

Pressing Up arrow key, generates Uncaught TypeError: Cannot read property 'top' of undefined

@kevin-brown
Copy link
Member

I was able to reproduce this, here's the traceback

Uncaught TypeError: Cannot read property 'top' of undefined
(anonymous function) @ select2.full.js:1076
S2.define.Observable.invoke @ select2.full.js:614
S2.define.Observable.trigger @ select2.full.js:604
S2.define.Select2.trigger @ select2.full.js:5167
(anonymous function) @ select2.full.js:5100
S2.define.Observable.invoke @ select2.full.js:614
S2.define.Observable.trigger @ select2.full.js:604
S2.define.Select2.trigger @ select2.full.js:5167
(anonymous function) @ select2.full.js:5018
S2.define.Observable.invoke @ select2.full.js:614
S2.define.Observable.trigger @ select2.full.js:608
(anonymous function) @ select2.full.js:1820
jQuery.event.dispatch @ jquery-git.js:4979
jQuery.event.add.elemData.handle @ jquery-git.js:4659

The issue appears to be that hitting UP will trigger the highlighting routines to shift the highlight, but that can't be done because there are no options in the dropdown. This should only happen if there is nothing in the results box, which currently can only happen if there is an AJAX error. Otherwise it will display the normal "no results found" message.

I'm tempted to call this a duplicate of #3501.

@Karmalakas
Copy link
Contributor Author

Actually I noticed this when I was trying to make options appear for multiple select, but was passing Ajax delay and dataType parameters. So no Ajax call was made, but also no options displayed :) That link to JsFiddle is what I mean

@raapperez
Copy link
Contributor

This error still occurs in version 4.0.5.

@alexweissman
Copy link
Contributor

Seems like it only happens in controls populated via AJAX, when no results are returned by a request (even a successful request).

@alexweissman alexweissman added this to the 4.0.6 milestone Nov 19, 2017
@alexweissman
Copy link
Contributor

Fixed in #5127.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants