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: registration of keys failed #91

Open
Hallasdor opened this issue Apr 8, 2015 · 2 comments
Open

bug: registration of keys failed #91

Hallasdor opened this issue Apr 8, 2015 · 2 comments
Labels

Comments

@Hallasdor
Copy link

Button keep being in 'pressed' state after surtain combinations.
This happens if you perform the following actions:
1] press and hold shift button
2] press and hold any of the 'num0', 'num1', 'num2', 'num3', 'num4', 'num5', 'num6', 'num7', 'num8', 'num9', 'num.' buttons
3] release the shift button
4] release the button pressed in [2]

The reason for this seems to be that these numpad buttons have a completely different button registration when pressing the shift button. As soon as you release the shift button, the release function registrates a different button for the release state.

This bug can be repeated everytime if you follow the 4 steps.

It is probably impossible to register the correct buttons (I'm assuming the browser registers the 'wrong' button), so maybe you should (also) register the numpad buttons in these specific scenario's

@Hallasdor
Copy link
Author

I have created a (dirty) fix for this problem. Hopefully this will help others in the future.

Listener.prototype._key_down = function (key, e) { // line 451

function checkForCounterpart(key, list) {
    if (list.length > 0) {
        var index = list.indexOf(key);
        if (index > -1) {
            list.splice(index, 1);
        }
    }
};

switch (key) {
    case "num_decimal":
        checkForCounterpart("delete", this._keys_down);
        break;
    case "num_0":
        checkForCounterpart("insert", this._keys_down);
        break;
    case "num_1":
        checkForCounterpart("end", this._keys_down);
        break;
    case "num_2":
        checkForCounterpart("down", this._keys_down);
        break;
    case "num_3":
        checkForCounterpart("pagedown", this._keys_down);
        break;
    case "num_4":
        checkForCounterpart("left", this._keys_down);
        break;
    case "num_5":
        checkForCounterpart("num", this._keys_down);
        break;
    case "num_6":
        checkForCounterpart("right", this._keys_down);
        break;
    case "num_7":
        checkForCounterpart("home", this._keys_down);
        break;
    case "num_8":
        checkForCounterpart("up", this._keys_down);
        break;
    case "num_9":
        checkForCounterpart("pageup", this._keys_down);
        break;
}
... //the original code

}

@dmauro dmauro added the bug label Apr 8, 2015
@dmauro
Copy link
Owner

dmauro commented Aug 16, 2015

What browser/OS combo are you seeing this with? Are any other supported keys doing this? I can't reproduce it on OS X + Chrome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants