[BUG] useHotkeys
Triggers Incorrectly when in Fullscreen Mode
#1067
Labels
bug
Something isn't working
useHotkeys
Triggers Incorrectly when in Fullscreen Mode
#1067
Problem:
When using
useHotkeys
to switch to fullscreen mode, there seems to be a chaining key problem. For instance, I've defined a hotkeyf
to enter fullscreen mode:I've also defined another hotkey
a
to increment a counter:The issue arises when I press the
f
key to switch to fullscreen mode. If I quickly press another key (even if it's notf
), it mistakenly assumes thef
key was pressed and triggers thef
key event handler. Interestingly, theevent
parameter's key is notf
.Maybe I am not clear, but please take a look at this screenshot, I put this exception event log results.
If, as shown in the figure, I didn't press the F key but an event related to this F key occurred, you can see that this key should be Z.
In this situation, pressing any key triggers the behavior of the F key. If I exit full screen mode and press any key, it will still behave as the F key and enter panoramic mode.
Steps to Reproduce:
f
key to enter fullscreen mode.f
key event handler is triggered, even though thef
key was not pressed.esc
to exit FullscreenF
event handler, and enter fullscreenMinimal Reproducible Demo:
https://codesandbox.io/s/zealous-cartwright-wdt5mt?file=/src/App.js
https://wdt5mt.csb.app/
Expected behavior
F
if thef
key is not pressed.Screenshots
CleanShot.2023-08-18.at.1.47.00.mp4
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: