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

[BUG] MAC OS X command + c broke all #6

Open
lokhmakov opened this issue Aug 21, 2016 · 10 comments
Open

[BUG] MAC OS X command + c broke all #6

lokhmakov opened this issue Aug 21, 2016 · 10 comments

Comments

@lokhmakov
Copy link

lokhmakov commented Aug 21, 2016

  1. After single press command + c HumanInput thinks that I hold c
  2. After 5000ms pseudo hold HumanInput react on watchers and thinks that already c holded
  3. After some timeout HumanInput starts work normaly, in DEBUG no info
  4. http://jsbin.com/bexojekapi/1/edit?html,js,output
  5. http://imgur.com/DZtvWpp
@lokhmakov
Copy link
Author

lokhmakov commented Aug 21, 2016

After pressing only Enter and HI.pause() - HumanInput thinks that I hold Enter

@liftoff
Copy link
Owner

liftoff commented Aug 26, 2016

What browser/version are you using?

@lokhmakov
Copy link
Author

Chrome 52.0.2743.116 (64-bit)

@liftoff
Copy link
Owner

liftoff commented Aug 26, 2016

I just commandeered my wife's Mac and can confirm this behavior. It appears to be a bug in Mac OS X itself since it is exhibited in Chrome, Firefox, and Safari. Essentially, the browser does not fire the keyup event if the command key is held at the same time. The only keyup event you'll get is for the command key itself.

I'll see if I can implement a workaround that resets the state of all keys held during a command+ keystroke on Macs (to prevent the hold event from misfiring) but I can't work around the fact that on Macs you'll never get that keyup event in these situations. So something like HI.on('command-c', doStuff) would work but if you also had a keyup:c event at the same time it would never get triggered if the command key was held during a combo.

Interestingly, this bug doesn't appear to effect the other modifier keys. So command-shift would work without issue.

@lokhmakov
Copy link
Author

Ok

liftoff added a commit that referenced this issue Aug 27, 2016
… keyup events if the command key was held during a combo. This should resolve issue #6

keymaps.js:  Moved the MACOS constant to constants.js
feedback.js:  Moved AllModifiers to constants.js
@liftoff
Copy link
Owner

liftoff commented Aug 27, 2016

I just pushed a commit that should fix this issue. Can you pull the latest code and confirm/deny?

@lokhmakov
Copy link
Author

Yep, 1.1.13 fix this

http://jsbin.com/nodofoguza/edit?html,js,output

@lokhmakov
Copy link
Author

But

After pressing only Enter and HI.pause() - HumanInput thinks that I hold Enter

Is still here

@lokhmakov
Copy link
Author

@lokhmakov lokhmakov reopened this Aug 28, 2016
@liftoff
Copy link
Owner

liftoff commented Nov 17, 2017

OK I've finally got around to trying to test this on a Mac and I cannot reproduce it. Is this still happening? Here's what I've been using to test:

function onLeft() {
    console.log('LEFT')
}

function onEnter() {
    HI.pause();
    console.log('ENTER PAUSE');
}
HI.off('left'); HI.off('enter');
HI.on('left', onLeft);

HI.on('enter', onEnter);

Then I check HI.state to see if there's anything in the down or downAlt arrays but every time I test it they're both empty (as they should be). It doesn't think that the enter key is still held down.

I tested in Chrome and Safari on a Mac (no idea what version it was--only had it for a few minutes). What browser were you using?

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