Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backspace and delete shortcuts fire when input is focused #66

Open
wouterh opened this issue Jul 2, 2018 · 1 comment
Open

backspace and delete shortcuts fire when input is focused #66

wouterh opened this issue Jul 2, 2018 · 1 comment

Comments

@wouterh
Copy link

wouterh commented Jul 2, 2018

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

@wouterh wouterh changed the title backspace and delete shortcuts fires when input is focused backspace and delete shortcuts fire when input is focused Jul 2, 2018
@jalmarazg
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants