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

Fix incorrect order of downKeys #432

Open
YuxuanWeng opened this issue Jun 25, 2023 · 3 comments
Open

Fix incorrect order of downKeys #432

YuxuanWeng opened this issue Jun 25, 2023 · 3 comments

Comments

@YuxuanWeng
Copy link
Contributor

I discovered that when using hotkeys('*', {keyup:true, keydown:true}, handler), with the keyup and keydown options set to true, if there are other hotkeys('*', {}, handler2) listeners present, the _downKeys order gets rearranged. This causes an issue when I'm implementing keyboard shortcuts persistence because the order of keycodes retrieved using getPressedKeyCodes after keyup is incorrect.

Here is the reproducible link: https://codesandbox.io/s/eager-pond-cstwrz?file=/src/App.tsx

@jaywcjlove
Copy link
Owner

@YuxuanWeng Your fix has been reverted because it caused some problems with scope. #434

@YuxuanWeng
Copy link
Contributor Author

https://codesandbox.io/s/eager-pond-cstwrz?file=/src/App.tsx
@jaywcjlove 大佬可以看下这个case吗?先按住cmd再按住k,getPressedKeyString的结果会出现k+cmd,而不是cmd+k

@jaywcjlove
Copy link
Owner

先摁的 k 键,再摁 cmd 会出现这种问题,我想了一下,如果先摁 c 再摁 cmd 也不能复制

重现问题

按住 cmd ,第一次按 k 返回 cmd+k, 不松开 cmd 第二次按 k 返回 k+cmd

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