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

Question For Modifier Keys #95

Open
leopold-zw opened this issue Mar 31, 2022 · 0 comments
Open

Question For Modifier Keys #95

leopold-zw opened this issue Mar 31, 2022 · 0 comments

Comments

@leopold-zw
Copy link

I tried to use keyName='*' to listen to every key, then I got this issue:

When I pressed 'shift' + 'command' at the same time, onKeyDown was trigged for twice, which is right. Then I released 'shift' and 'command' respectively, the question is that 'onKeyUp' was only trigged once.But I need to know both status of them.And because of the issue#27 from the repository hotkeys, I cann't fix this by using keyName='shift'.

I found the reason:

handleKeyUpEvent(e: KeyboardEvent) {
  if (!this.isKeyDown) return;
  this.isKeyDown = false;
  if (this.props.keyName && this.props.keyName.indexOf(this.handle.shortcut) < 0) return;
  this.onKeyUp(e, this.handle);
  this.handle = {} as HotkeysEvent;
}

this.isKeyDown was set to false so that onKeyUp will not be trigged for the second time.

That's all I know. Unfortunately, I have no idea to fix this.

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

1 participant