xyflow/xyflow
useKeyPress doesn't track repeated combination keypresses until the entire combination is released
開放
#2,248 建立於 2022年6月28日
help wantedtopic:keys
倉庫指標
- 星標
- (19,286 顆星)
- PR 合併指標
- (平均合併 2天 1小時) (30 天內合併 20 個 PR)
描述
Describe the Bug
When using useKeyPress to track combinations of keys, for example Meta+z, repeated keypresses are not captured if you continue to hold down the Meta key.
Your Example Website or App
https://codesandbox.io/s/recursing-driscoll-stvwou?file=/src/App.js
Steps to Reproduce the Bug or Issue
When const comboPressed = useKeyPress("Meta+z");:
- Press and hold
Meta - Press and hold
z comboPressedis true- Release
z comboPressedis still true and so additional presses ofzcan't be detected- Release
Meta comboPressedis now false
The inverse does not have the same behaviour:
- Press and hold
z - Press and hold
Meta comboPressedis true- Release
Meta comboPressedis now false and so additional presses ofzcan be detected
Expected behavior
As a user I would expect that after I press Meta and z, and then continue to hold Meta but release z that the pressed state of useKeyPress("Meta+z") is false.
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: 103.0.5060.53
Additional context
No response