Skip to content Skip to sidebar Skip to footer

Are There Any Libraries That Have Keyup/keypress KeyCode Normalization Code?

I'm looking for something that essentially codifies the browser weirdnesses listed here: http://unixpapa.com/js/key.html and http://www.javascripter.net/faq/keycodes.htm into a lib

Solution 1:

I think http://jonathan.tang.name/files/js_keycode/ might do what you're looking for.

Side note: It looks like all jQuery does for which is this:

if (!event.which) {
  event.which = event.charCode != null ? event.charCode : event.keyCode;
}

Solution 2:

After a year of nothing, I created the keysight module to make dealing with keyboard events much easier. Example:

 domNode.addEventListener("keyup", function(event) {
    if(keysight(event).key === 'down') {
       // do some down action
    }
 })

Post a Comment for "Are There Any Libraries That Have Keyup/keypress KeyCode Normalization Code?"