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

Add options for `specificKeys` instead of just `ignoredKeys` for keyboard event #84

Closed bk3 closed 5 years ago

bk3 commented 5 years ago

Add option to add specificKeys to detect keyboard press. This is useful for say, only listening to a user using their tab key. I'll be opening a PR soon. Let me know if there are any issues with this.

Thanks :)

ten1seven commented 5 years ago

Hi @bk3! That sounds good to me and thanks for taking the initiative to throw it together!

I'd love to hear the use case for this functionality if you're able to share.

bk3 commented 5 years ago

Hey @ten1seven essentially I ran into an issue where the user clicking any key (say, s) would trigger the focus styles to appear since the styles are specifically for [data-whatintent="keyboard"]. In my team's use case, we only want to listen to the tab keyboard clicks to display the focus styles.