7

I'm making a web application that uses the keyboard quite extensively. I notice that the builtin browser event handling is inconsistent across browsers, and jQuery does not normalize very well (eg. Firefox sends a keypress for backspace, chrome doesn't). I'm wondering if there is a javascript library that normalizes these idiosyncrasies and presents a uniform interface to keyboard event handling.

6
  • I don't have an answer to your larger question, but I do know it's recommended to use 'keyup' instead of 'keypress' because of lack of implementation across browsers. Commented Jun 19, 2011 at 19:02
  • Would this be an answer? Commented Jun 19, 2011 at 19:06
  • 2
    You may be doing something that will be wonderful, but just as a note: it's pretty risky to make a web application that behaves in ways that are significantly different from other web applications. For something like a game, it may be a great idea because it may add interest and challenge. For something like a banking application, it may cause a lot of confusion and frustration. Commented Jun 19, 2011 at 19:08
  • 1
    Try stepanreznikov.com/js-shortcuts Commented Jun 20, 2011 at 7:36
  • 2
    @kinakuta: You can't use keyup instead of keypress in general: they serve different purposes. keyup fires when a key is released whereas keypress fires immediately after a key is pushed down (and may be fired when auto-repeating characters are generated as the key is held down). keypress is the only event that can tell you anything reliable about the character typed; keyup and keydown only tell you the code of the physical key that was pressed/released. Actually all major browsers support keypress, but there is some variation in implementation: unixpapa.com/js/key.html Commented Jun 20, 2011 at 22:06

1 Answer 1

1

Here are a couple:

http://habrahabr.ru/blogs/jquery/76424/

http://www.openjs.com/scripts/events/keyboard_shortcuts/

http://wiki.fluidproject.org/display/fluid/Keyboard+Accessibility+Plugin+API

Note that the first is in Russian, but Google Translate does a good job of translating it. translate.google.com

I haven't tried any of them, but haven't seen anyone else suggest anything. Hopefully that gives you a starting point. Good luck!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.