I am developing a quite large web application, and it is probably a good idea to use hotkeys for some common tasks. However, I discovered that finding safe key combinations is a problem, regarding all different browsers and OSes.
For example, Chrome has such a long list of hotkeys that trying to use some kind of logical hotkeys scheme for my web application is impossible - e.g. Ctrl + 1, Ctrl + 2, Ctrl + 3, etc.
Do you have some cheat sheet of safe hotkeys which can be used in a web application and not worry about some browser or OS interference?
Ctrl+N – Open a new browser window. Alt+F4 – Close the current window.
I wouldn't count on it. It's probably okay to listen for shortcuts that use the Alt modifier, but there's still no way to be sure a keyboard shortcut is free. Users can always install programs that listen for keyboard shortcuts, or use a browser you didn't expect.
If the shortcuts can be used only when the user is not typing in a textbox or something, it might be a better idea to just listen for keys pressed without a modifier key.
If no textbox or other GUI element is focused, then document.activeElement == document.body
should be true (somebody correct me if I'm wrong).
I don't think there is such a list. This may even be different for different locales.
You can try to rely on the accesskey feature of HTML: http://www.w3.org/TR/html401/interact/forms.html#adef-accesskey. This should keep the number of collisions relatively small. Though I believe the Windows browsers will offer these keys as Alt+Letter which collides with the menu bar.
Alternatively do what Google reader and Gmail do: use the letters directly without any hotkey modifier. That will only work for certain types of applications, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With