react-hotkeys
react-hotkeys copied to clipboard
[Feature] Allow for repeat keys
Is your feature request related to a problem? Please describe.
I understand repeat keys aren't desired for certain things, but in many cases they are. This proposal is just to make it configurable, likely at the keyMap level, but perhaps at the handler level would be more flexible.
Describe the solution you'd like
<HotKeys
keyMap={{
down: 'down',
up: 'up',
...keyMap,
}}
repeatable={['down', 'up']}
style={hotKeyStyle}
handlers={innerHandlers}
{...props}
/>
or within the handler
<HotKeys
keyMap={{
down: 'down',
up: 'up',
...keyMap,
}}
>
<HotKeys handlers={{ down: (e) => { e.repeat } }} />
</HotKeys>
Are you talking about ignoreRepeatedEventsWhenKeyHeldDown: true in the Docs?
Yea but having that global isn’t very useful if you have even one case where you’d need both behaviors.
Agreed @natew, I have long wanted to be able to configure all (applicable) options at 3 levels:
- Globally (currently exists)
- At the component level (perhaps inherited by children)
- And at the keymap or handler level
I just haven't had the time to build it in.
@greena13 thanks for this library, it's quite useful! However this issue of not being able to configure repeat option at the keymap/handle level is critical for us. Do you see any chance this getting added any time soon, or if someone created a PR for it?