react-shortcuts
react-shortcuts copied to clipboard
backspace and delete shortcuts fire when input is focused
The delete and backspace keys should be treated in the same way as regular keys when an input is focused as they are needed for text input. This is currently not the case.
See this example: https://codesandbox.io/s/zrp902nkzl
Hi!
To accomplish what you are trying to do, you need to add the property alwaysFireHandler="true"
to ensure that, when certain keys are pressed on an active element (like an input) the shortcut executes correctly.
Code should be modified like this:
return (
<Shortcuts name="BOX"
handler={handleMove}
alwaysFireHandler="true" >
<div style={style} name="test">
{index + 1}
<input type="text" />
</div>
</Shortcuts>
);
and it should do the trick :)

The modified codesandbox code can be found here