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

[BUG]The keyboard combination doesn't work in focused input #1133

Open
Dulatto opened this issue Feb 8, 2024 · 2 comments
Open

[BUG]The keyboard combination doesn't work in focused input #1133

Dulatto opened this issue Feb 8, 2024 · 2 comments

Comments

@Dulatto
Copy link

Dulatto commented Feb 8, 2024

Hello,
Please check the code below. What am I doing wrong or missing?

useHotkeys('shift+n', () => console.log('shift + n pressed'), { enableOnTags: ['INPUT'] });
<input type='text' id='fname' name='fname' />

This is part of React component code. If the focus is outside of input the console shows the message, but not if the focus is in input.
I need to show the console message when the input is in focus. Thanks.

  • OS: Windows 10
  • Browser: chrome
  • Version: 121.0.6167.160
@collinsleewyatt
Copy link

collinsleewyatt commented Feb 13, 2024

Try putting {enableOnFormTags: true} in the third argument.

@Dulatto
Copy link
Author

Dulatto commented Feb 23, 2024

I tried like: useHotkeys('shift+n', () => console.log('shift + n pressed'), { enableOnTags: ['INPUT'], enableOnFormTags: true });,
and still can get console message in any places of screen. I even tried : useHotkeys('shift+n', () => console.log('shift + n pressed'), { enableOnTags: ['INPUT'] }, { enableOnFormTags: true }); to avoid the misunderstanding :)

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