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

Registering one shortcut with element (ref in React) and after that one without element makes both (all) shortcuts global #247

Open
danvln opened this issue Feb 16, 2021 · 2 comments

Comments

@danvln
Copy link

danvln commented Feb 16, 2021

Hello,

I tried to use the library unsuccessfully. I trying registering one shortcut with element (ref in React) and after that one without element. The second shortcut registration makes both (all) shortcuts global.

Is this expected behavior, it does not seem right.

Here is some code as sample..
first one

 hotkeys('r',
            { element: ref.current, },
            handlerMsg);

and second one

 hotkeys('t',
            { element: null, },
            handlerMsg);

I would expect "r" to work only on the ref element, and "t" to work on the global.

Well, if I don't execute the second hotkeys code, then r is attached to ref element. But if the second one is executed then everything is made global.

@jaywcjlove
Copy link
Owner

@danvln This may be a issue.

@MyCupOfTeaOo
Copy link

I had the same problem

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

3 participants