question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to ignore repeating keyboard event

See original GitHub issue

I am trying to migrate my Application from react-hotkeys.

I am wondering by any chance to have a options like

ignoreRepeatedEventsWhenKeyHeldDown: boolean

in react-hotkeys-hook?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
michaeljblumcommented, Oct 6, 2020

Yeah I was trying to achieve something similar to what @Taymindis was looking for I believe. Even with the {keyup: true} config, you still get loads of repeated function calls if you hold the specific key combo. I wanted the function to be called just once, irregardless of how long the user presses/holds the specific key combo.

For anyone looking to accomplish this: (e) => !e.repeat && exampleFunc(), without the keyup config in the next argument, seems to work.

0reactions
Nate-Wilkinscommented, Dec 2, 2022

I’m trying to get my configuration to fire when the combo is held.

Was this changed in a recent version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable repetitive keydown in JavaScript - Stack Overflow
To ignore key events caused by key repeats, keep track of which keys are pressed during the keydown and keyup events.
Read more >
KeyboardEvent.repeat - Web APIs - MDN Web Docs
The repeat read-only property of the KeyboardEvent interface returns a boolean value that is true if the given key is being held down...
Read more >
Set how quickly a key repeats on Mac - Apple Support
On your Mac, choose Apple menu > System Settings, then click Keyboard in the sidebar. · Drag the “Delay until repeat” slider on...
Read more >
Manage repeated key presses - Official Ubuntu Documentation
Manage repeated key presses ; Open the Activities overview and start typing Settings. ; Click on Settings. ; Click Accessibility in the sidebar...
Read more >
How to avoid clicked key auto-repeat in blazor server?
From the Built-in event arguments, we can see the KeyboardEventArgs class has the Repeat property, if a key has been depressed long enough...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found