dmauro / Keypress

A keyboard input capturing utility in which any key can be a modifier key.
http://dmauro.github.io/Keypress/
Apache License 2.0
3.18k stars 313 forks source link

IE8 compatibility #3

Closed arno14 closed 11 years ago

arno14 commented 11 years ago

I have this warning on IE8 'keyCode' has null value or is not an object at keypress.js line 10 char 370 (original avert is in french)

in IE, it seems that onkeydown does not pass event in callback function ( e = 'undefined') at line 488

dmauro commented 11 years ago

Hi, sorry I haven't done any work to support IE8 and expect it won't work without a bit of love and care. If you don't need all the bells and whistles, you should check out Mousetrap.js: http://craig.is/killing/miceas it is tested and works in IE6+

On Fri, Dec 14, 2012 at 6:59 AM, Arnaud notifications@github.com wrote:

I have this warning on IE8 'keyCode' has null value or is not an object at keypress.js line 10 char 370 (original avert is in french)

in IE, it seems that onkeydown does not pass event in callback function ( e = 'undefined') at line 488

— Reply to this email directly or view it on GitHubhttps://github.com/dmauro/Keypress/issues/3.

richard77 commented 11 years ago

Hi there @dmauro ! I would love to use your lib with IE8 support. I've got the same issue as @arno14 mentioned above. I'll try to look into the issue. @arno14 have you been able to solve the problem?

Update: I've found this stackOverflow item which might solve things: http://stackoverflow.com/questions/1750223/javascript-keycode-values-are-undefined-in-internet-explorer-8

Update2: I've forked the project and seem to have a working lib for IE8 now. in short: Add array.filter support Check if event in keydown and keyup event handlers should be window.event object and finally add check in prevent_default method if e.preventDefault exists, otherwise use e.returnValue = false.

@dmauro any ideas on how to include this in your repo? I'm fairly new to github.

dmauro commented 11 years ago

You should be able to do a push request, never actually done it myself though. If you can't figure it out, I'll take a peak at yours and try to figure out how to pull in the fixes. Thanks for solving the IE problems though! Awesome work :)

richard77 commented 11 years ago

@dmauro I've done a pull request, my guess is that you should be able to add it to your master. Glad to be able to help you with this great lib!

dmauro commented 11 years ago

Thanks for the help guys, I didn't actually test this myself, but gonna close this for now.