ten1seven / what-input

A global utility for tracking the current input method (mouse/pointer, keyboard or touch).
https://ten1seven.github.io/what-input
MIT License
1.35k stars 89 forks source link

Ignore some keys? #56

Closed FezVrasta closed 7 years ago

FezVrasta commented 7 years ago

For example, I have a component that accepts CMD + Click.

I would like the data-whatinput to stay to mouse since the user isn't actually going to use the keyboard to navigate the app in any way.

Having the ability to define a list of ignored keys would be handy.

ten1seven commented 7 years ago

Hey @FezVrasta, there's already a list of ignored keys that includes CMD, however I'm seeing a bug where the key is ignored correctly on keydown but missed on keyup. I'll look into that!

ten1seven commented 7 years ago

@FezVrasta just pushed up v4.1.2 that should fix the mouse modifier keys. Let me know if that does the trick.

ten1seven commented 7 years ago

I've been working on v5.0.0 and added an API option to overwrite the default ignored keys:

whatInput.ignoreKeys([1, 2, 3])
FezVrasta commented 7 years ago

It fixed it, thank you!