Git Product home page Git Product logo

Comments (2)

keithamus avatar keithamus commented on July 30, 2024

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.

olecrivain avatar olecrivain commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.