Skip to content


Subversion checkout URL

You can clone with
Download ZIP


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

JBenSheppard opened this Issue · 9 comments

5 participants


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?


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:"keydown", this.bind(function (e) {

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

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.



what browser? tabbing works fine on the demo site.


FF. Should I be able to take a new copy of select2 from here and use it?


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


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

tabbing from field to field works fine


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?


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
Something went wrong with that request. Please try again.