HumanInput icon indicating copy to clipboard operation
HumanInput copied to clipboard

[BUG] MAC OS X `command + c` broke all

Open lokhmakov opened this issue 8 years ago • 10 comments

  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 avatar Aug 21 '16 09:08 lokhmakov

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

lokhmakov avatar Aug 21 '16 11:08 lokhmakov

What browser/version are you using?

liftoff avatar Aug 26 '16 15:08 liftoff

Chrome 52.0.2743.116 (64-bit)

lokhmakov avatar Aug 26 '16 15:08 lokhmakov

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.

liftoff avatar Aug 26 '16 15:08 liftoff

Ok

lokhmakov avatar Aug 26 '16 16:08 lokhmakov

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

liftoff avatar Aug 27 '16 14:08 liftoff

Yep, 1.1.13 fix this

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

lokhmakov avatar Aug 27 '16 17:08 lokhmakov

But

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

Is still here

lokhmakov avatar Aug 27 '16 17:08 lokhmakov

Try it http://jsbin.com/kahusajica/1/edit?html,js,output

lokhmakov avatar Aug 27 '16 17:08 lokhmakov

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?

liftoff avatar Nov 17 '17 15:11 liftoff