CMD key modifier on Mac will cause keyboard to become stuck

  • Please also read the follow up post. I have a workaround but it still seems there is a potential bug.

    Problem Description

    Keyboard entry using the CMD key modifier on Mac will cause the keyboard to become stuck after 2 or 3 keypresses.

    Attach a Capx

    The capx is rudimentary: here.

    It's basically this:

    Description of Capx

    Displays keycodes pressed as reported by Construct 2 (Keyboard.LastKeyCode) in one text object and the Java (browser.execjs("event.code")) in another text box. Both methods of displaying the keycode are affected by this issue.

    Steps to Reproduce Bug

    • Go to this C2 Example on a Mac in Safari or Chrome.
    • Press CMD + " then CMD+ \ without letting go of the command key. After doing this once or twice, you will then have to release all keys and press a random key once or twice to get a response again.

    Observed Result

    Keyboard input will become "stuck" after typing a couple of combos. "Stuck" meaning it will require the user to release all keys and type 1 or 2 random keystrokes until there is keyboard response again.

    This Mac-specific issue does not occur when doing the same test with the Shift, Alt/Option or Control keys.

    Expected Result

    The CMD modifier shouldn't cause keyboard input to "stick". It should behave as the other modifier keys do. I was thinking that this may be occurring at the OS level, but if you go to keycode.info, you can type CMD + " and CMD + \ back and forth all day and it won't "get stuck". This little app listens with .onkeydown.

    Why am I so worried about this? The overall purpose is for an app (currently in beta) that tests user knowledge of keyboard shortcuts for a popular audio program.

    Web demo is here, it's currently in beta in the Apple and Google Play stores. I need to have an nw.js version that accepts keyboard input, though, wherein this issue makes the app rather unusable.

    Affected Browsers

    This happens on Mac in Safari, Chrome or nw.js. I have not found a browser/version where this does not occur on Mac. I only care about Chromium/nw.js

    Operating System and Service Pack

    MacOS High Sierra.

    Construct 2 Version ID

    It happens in either C2 (R250) or C3 (the free version).

    Thanks!

    -Steve

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I've found more about the problem and have a workaround, but this is still strange behavior.

    More about the problem

    What's really happening on Mac is that when the CMD modifier is used on Mac, it is causing the modified key to become stuck "down". For example, If I press CMD+T, it will register but then the T key will be stuck in a down status. the T key wont regsitry again until I release the command key and press T alone to clear the stuck "down". Then, "T" or "CMD +T" will register again (but will again cause T to become "stuck").

    Workaround

    My program has an onscreen keyboard in nwjs that tests the user on keyboard shortcuts. As soon as a non-modifier key has been pressed, I use Rex's rex_simulate_keyevent plugin to fire an "up" for that key after the code has parsed it. That seems to clear the apparent issue. Thanks for saving the day, rexrainbow !

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)