Oscar Godson
Oscar Godson

Reputation: 32726

jKey (JavaScript key shortcut plugin) Issue

Me and a friend are writing a plugin for jQuery that makes it easy for devs to add key shortcuts and we're damn close but no cigar. We're having issues with the key combos. It seems like we are having issues when you call the same selector multiple times on a page.

Try pressing alt+a... youll see it works one time, then gets all mangled up. Anyone know how to fix it? It'll be on github after it's corrected and I'd be happy to add "thank you to" link to whoever can fix this in the header with the copyright info :)

It's nicely documented and i have all the code and stuff here. So... anyone?

http://jsbin.com/azaha4

-- UPDATE --

Has been fixed and it's now on:

Github: http://github.com/OscarGodson/jKey

Full Documentation: http://oscargodson.com/labs/jkey/

Upvotes: 1

Views: 1514

Answers (1)

Macy Abbey
Macy Abbey

Reputation: 3887

Scratch that, the problem is caused by the keyup() event handler not being invoked, but that is not caused by your e.preventDefault call as I removed them and it still has the same issues.

Figured it out -- you can't alert in the callbacks. This breaks the event chain. If you remove the alerts and instead do notifications to the user via HTML then all is well.

Upvotes: 2

Related Questions