Giter Club home page Giter Club logo

Comments (3)

damusnet avatar damusnet commented on June 2, 2024

After a bit of investigation, this sort of makes sense. When pressing combo keys, the following is (roughly) registered:

  • Add shift
  • Add ?
  • Remove shift
  • Remove / <= that's the issue ; it's because without the shift, the ? key is now registered as a / key. So ? is never removed from the currently pressed keys, and any press to shift triggers the combo again.

This is on a en-US keyboard, but I suspect it's true for any shift combo on any keyboard. The particular key here is:

┌─────┐
│  ?  │
│  /  │
└─────┘

Not sure how best to fix this, as I don't fully understand the entire implementation logic.

Incidentally, pressing / then shift, which should (could?) produce the shift+?, does not work either.

from react-hotkeys-hook.

tamerxkilinc avatar tamerxkilinc commented on June 2, 2024

I solved this by doing the same as for the command key. On macOS the keyup event of letters and digits is not triggering while holding the command key down. That's why you can't just remove single keys of the array but need to clear it. The way I solved this also worked for the shift key!

Set a timeout each time shift is pressed. When it is released, instead of trying to remove the specific characters which were pressed with the shift key, the array of pressed keys is cleared completely. This ensures that you have no characters left in the pressed keys array.

from react-hotkeys-hook.

JohannesKlauss avatar JohannesKlauss commented on June 2, 2024

Yes this is currently a problem, because the library mixes the produces symbol with the produced key code. This will be fixed in version 5.

from react-hotkeys-hook.

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.