Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

accesskey VS navigator keyboard shortcut

It seems to be a recurrent tricky question but I still don't have a fix nor workaround for it:

Is there a way to intercept accesskeys before keyboard shortcuts?

I need to use accesskeys on my favorites navigator IE and also FF, but I don't wan't to consider existing shortkeys as reserved. Otherwise it doesn't leave a lot of possibilities (currently I only use numbers).

Note: by accesskey, I mean the accesskey html attribute.

Any idea ? Flash apps can do it, so what about JavaScript ?


For example here is an accessible control:
<button onclick="alert('Hello');" accesskey="F">Alt+F to activate</button>

When I try to activate it I just open File menu :'(

like image 429
sinsedrix Avatar asked Feb 02 '12 15:02

sinsedrix


1 Answers

John Resig (the creator of jQuery) has been working on a "hotkey" addon for jQuery which should do what you are looking for.

https://github.com/jeresig/jquery.hotkeys

I know this isn't a 'jQuery question', and adding a framework for something 'small' isn't ideal, but it should offer a solution. On the other hand, you can always look over how he did it for inspiration.

like image 162
Tango Bravo Avatar answered Sep 25 '22 05:09

Tango Bravo