xyflow/xyflow
在 GitHub 查看useKeyPress doesn't track repeated combination keypresses until the entire combination is released
Open
#2,248 建立於 2022年6月28日
help wantedtopic:keys
描述
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