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

ShortCuts preventing other key handling event to call #33

Open
singhalsurbhi07 opened this issue Jun 7, 2017 · 1 comment
Open

ShortCuts preventing other key handling event to call #33

singhalsurbhi07 opened this issue Jun 7, 2017 · 1 comment

Comments

@singhalsurbhi07
Copy link

I have a component on which I have Shortcuts implemented for arrow keys. Then I have another component parallel to that which uses onKeyPress event. The issue is the keyPress event works fine till the component with ShortCut is not loaded. Once the component with Shortcut is loaded my keyPress event doesnot work. Any idea why ??

@greena13
Copy link

greena13 commented Oct 15, 2017

Hey singhalsurbhi07,

I believe this is an issue with react-shortcuts: it prevents onKeyPress events from firing.

You can get around this by switching to onKeyDown or onKeyUp and using the isolate prop in you <Shortcuts> component:

<Shortcuts name='TODO_ITEM' isolate handler={ myHandler }>
    // ...
</Shortcuts>

<YourComponent onKeyDown={ this.handler } />

I have created a pull request for what I think are some improvements to the documentation that explains this further. You can read more about this issue 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