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

keyUp is generating duplicate (shifted) keypresses on Firefox and Chrome on Mac #258

Open
GoogleCodeExporter opened this issue Mar 16, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
  1. login to bash (or any other service) with shellinabox
  2. press any alphabetic key, and keep it pressed for a second or two
  3. release the key


What is the expected output? What do you see instead?

  Expect the pressed key to be input (and echoed), If you've kept it pressed long enough, expect the pressed key to repeat (until you release it). 

  What actually happens is that the key is input correctly when you press the key down. It doesn't repeat. But when you release the key, the character is input a second time. If you'd typed a lower-case character, the repeated character is inserted as its upper-case equivalent (though there is no SHIFT key pressed). 

What version of the product are you using? On what operating system?

  version 2.14, on Mac OSX 10.9.2 Mavericks.

Please provide any additional information below.

  Only a problem with Chrome and Firefox. It works as expected (no keyUp event fired) on Safari.


I worked around the problem by putting in a hacky patch:

--- vt100.js.orig   2014-04-04 17:18:02.000000000 +0100
+++ vt100.js    2014-04-04 17:30:28.000000000 +0100
@@ -3102,6 +3102,7 @@
       fake.metaKey                = event.metaKey;
       if (asciiKey) {
         fake.charCode             = event.keyCode;
+        if (!event.shiftKey) fake.charCode |= 040; /*  if it's not shifted, 
lower-case it */
         fake.keyCode              = 0;
       } else {
         fake.charCode             = 0;
@@ -3110,8 +3111,10 @@
           fake                    = this.fixEvent(fake);
         }
       }
-      this.lastNormalKeyDownEvent = undefined;
-      this.handleKey(fake);
+      if (!asciiKey || fake.charCode != lastNormalKeyDownEvent.keyCode) {
+        this.lastNormalKeyDownEvent = undefined;
+        this.handleKey(fake);
+      }
     }
   }


Original issue reported on code.google.com by [email protected] on 4 Apr 2014 at 4:45

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

No branches or pull requests

1 participant