keithamus/jwerty — Issue #1: Numbers binding
Author: olecrivain
Created: 2011-10-11 15:41:30+00:00
State: open

Hi,

I'm evaluating your library for keyboard navigation in my project. I really
like the concept but I have some difficulties with number keys.

I want to bind numbers, from 0 to 9, so I started with this :

```javascript
jwerty.key('[0-9]', function (e) {
alert(e.which);
});
```

It didn't work for me because I have an azerty keyboard and I obtain '0' by pressing 'shift+0'
(http://www.computerhope.com/help/azerty.gif). This leads to :

```javascript
jwerty.key('shift+[0-9]', function (e) {
alert(e.which);
});
```

Works great, but I don't care if the numbers come from the numpad or the left of the keyboard.
I have to handle all of them the same way. So I tried this :

```javascript
// does not work
jwerty.key('shift+[0-9],num-[0-9]', function (e) {
alert(e.which);
});
```

```javascript
// does not work
jwerty.key('shift+[0-9],num-0,num-1,num-2,num-3,...', function (e) {
alert(e.which);
})
```

and finally this :

```javascript
jwerty.key('shift+[0-9]', function (e) {
alert(e.which);
});
jwerty.key('num-0', function (e) {
alert(e.which);
});
jwerty.key('num-1', function (e) {
alert(e.which);
});
.
.
.
jwerty.key('num-9', function (e) {
alert(e.which);
});
```

The last code works, but is not as easy as promising :)

I think the more inuitive way of handling numbers would be the first solution : '[0-9]'.
In my case, I don't need the distinction between numpad and normal keyboard (do some people really need that?).

What do you think?

Best regards
Olivier