jaywcjlove / hotkeys-js

➷ A robust Javascript library for capturing keyboard input. It has no dependencies.
https://jaywcjlove.github.io/hotkeys-js
MIT License
6.66k stars 410 forks source link

Add support for range of keys in one hotkey #361

Open pradeep-mishra opened 2 years ago

pradeep-mishra commented 2 years ago

Add support for a range like numbers or alphabets in one hotkey This would help make the site navigatable from keyboard only

suppose on any page, if we have 10-15 items, we can use range hotkey to bind all items to a single shortcut

like this key option+[0-9]{1:2} would cover all items in a page from option+0 to option+99 or we can remove the constraint and simply have option+[0-9] to add any number with option key to invoke the same hotkey e.g.: option+1 will invoke the same shortcut, which will, in turn select/click 1st item option+2 will invoke the same shortcut, which will, in turn select/click 2nd item option+99 will invoke the same shortcut, which will, in turn select/click the 99th item

The same can be done with alphabets like ctrl+[a-z]

webceoboy commented 11 months ago

+1