Comments (2)
The issue with Azerty keyboards is not something that can be easily fixed; there is no way to check of the type of keyboard, and the number keys fire the same keyCode
, regardless of modifier keys. You would be better off checking for shift key on or off combined with the number keys (we'll get to that).
The second problem is a slight misinterpretation of the syntax; 'shift+[0-9],num-[0-9]'
is a key sequence, in other words: shift+(number key) followed by a numpad number key. So instead you want to use a /
, to denote an optional key.
Lastly, the engine isn't advanced enough to pick out fragments of a key label, so 'num-[0-9]'
won't work. You'll instead need to use '[num-0-num-9]'
.
So in summary, to capture both sets of number keys you need to express a combo like so: '[0-9]/[num-0-num-9]'
. If you wanted to check for those numbers, regardless of shift key then you want something like: 'shift+[0-9]/[0-9]/shift+[num-0-num-9]/[num-0-num-9]'
. This obviously is fairly verbose, and it'd be great to use some kind of optional key syntax like RegEx's ?
key (so doing 'shift?+[0-9]'
) but I think that is out of scope for the issue you're reporting. As such I'm closing this as I don't think there is a valid issue within your description.
tl;dr: Use:
jwerty.key('shift+[0-9]/[0-9]/shift+[num-0-num-9]/[num-0-num-9]', function (e) {
alert(e.which);
});
from jwerty.
Thx you for your fast and very detailed answer. I ended up with 'shift+[0-9]/[0-9]/[num-0-num-9]'.
from jwerty.
Related Issues (20)
- Keyboard shortcut to launch modal window... HOT 2
- Bugs with some symbols (OSX) HOT 2
- Typo on the website
- ctrl+n binding? HOT 1
- Need for an ability to detect if ctrl/shift/alt key is active at current event HOT 3
- Unbind key will not work
- IE 8 issue when binding to enter key in textboxes HOT 2
- Key combo triggers on single key. HOT 1
- Rm canBridge.js
- Firing actually doesn't do anything in latest Chrome?
- Comparison with established keyboard libraries HOT 1
- Minus (-) key doesn't work HOT 2
- Unbinding should be internalized HOT 6
- Please push latest version to npm
- jwerty.key(...) returns nothing
- cmd+l not working in Safari
- get actual keys pressed when matching regex or optional HOT 1
- document using + sign HOT 4
- Difference between source code and archives/npmjs versions HOT 2
- Unbind doesn't work. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jwerty.