Numpad returns letters on first keystroke when textbox is not open #389

Closed
JBenSheppard opened this Issue Sep 7, 2012 · 9 comments

Projects

None yet

5 participants

@JBenSheppard

I implemented this on a site that I'm developing, and was testing it out in a few spots. The one place will be for a "quick entry" format where the user will be keying in (mostly) numbers. If the user tabs to the select2 control, and the first key they press is a number on the keypad, then it enters a letter instead of the number. (1-9 are a-i, and even the other keys on the numpad return letters as well).

Is there any way for me to fix that, or would it be something I would need to wait on an update for?

@kevin-brown
Member

This is one of the many issues that have come up recently from a patch I built in for mobile devices. The issue seems to be that Event.which is not the same everywhere. It is explained pretty nicely over at stackoverflow.

Lines 1521:

selection.bind("keydown", this.bind(function(e) {

Should be changed to:

selection.bind("keypress", this.bind(function(e) {

For consistency, line 1440 probably should be changed at the same time:

this.search.bind("keydown", this.bind(function (e) {
@JBenSheppard

Thanks! That works perfectly now. I haven't done too much javascript yet, so I wasn't sure where to start.

@ivaynberg ivaynberg closed this in 4b1204c Sep 13, 2012
@iceblox
iceblox commented Oct 4, 2012

Ive just tried to updated my js file using your commit and whilst it fixes the initial report issue. It doesnt allow me to tab through multiple dropdowns.

Before you could tab through but you got the letters when using numbers.

Cheers

@ivaynberg
Collaborator

what browser? tabbing works fine on the demo site.

@iceblox
iceblox commented Oct 4, 2012

FF. Should I be able to take a new copy of select2 from here https://github.com/ivaynberg/select2/blob/master/select2.js and use it?

@iceblox
iceblox commented Oct 4, 2012

The version on your demo site uses the old version of the js which may be why?

@ivaynberg
Collaborator

just updated the site to latest which was only a commit or so behind. you can see it here:

http://ivaynberg.github.com/select2/select2-latest.html

tabbing from field to field works fine

@iceblox
iceblox commented Oct 4, 2012

Hi Thanks for coming back to me so if you tab onto one of the drop downs use the drop down arrow to select then tab to move on you get no matches found? and the tab wont let you move from the drop down.

This worked ok on the previous release.

Hope this makes sense?

@WilliamStam

hit that snag now aswell... firefox only tho. chrome seems to work ok

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