Many users of my website asked for keyboard shortcuts to access commonly viewed pages. I know that links may have accesskey but to access them is inconsistent across browsers. I'm going to use JavaScript to detect shortcut and I would like your input on what the modifier key(s) should be. I'm leaning toward Ctrl+Shift.
|
|
||||
|
|
|
Two examples probably isn't enough to call it "established practice", but it's two big examples at least: Both Google and Twitter use none. Or, if you want to see it this way, their modifier key for navigation is G. To go to your Twitter "favorites" page, you hit G, then F. To go to your gmail drafts folder, hit G then D. Non-navigation shortcuts also use simple letters; e.g. J for moving forward in a list (tweets, emails, etc.), K for moving backwards.* * In my book, this is absolutely wrong. To me, "J" being to the left of "K" means "J" should be "previous" and "K" should be "next". However, doing it the other ways around seems to be the standard. Neither of the two use a "real" modifier key at all. We're also starting to look at keyboard shortcuts for the Stack Exchange sites, and we're likely to do the same thing. Two more reasons I see for not using a modifier key at all:
On the other hand, here are two caveats to consider:
– but all things considered, "no modifier key" at all seems like a good solution to me. |
|||||||||||
|
There's no 'best' or universal key modifier choiceYour best options are to:
In all cases, you might consider disabling shortcut keys by default to prevent unexpected behaviour for the majority of users who probably don't care about shortcut keys. Why not just pick a modifier combo?The reason I suggest these methods is that there's no standardised cross-platform modifier key that you can consider safe to use with JavaScript in a browser environment. Anything containing Ctrl, Shift, Alt, or Cmd will likely break some browser shortcuts on certain platforms. Your suggestion to use Ctrl+Shift, for example, will break Firefox shortcuts on Windows, many of which use that combination to perform special functions, such as Ctrl + Shift + D, which bookmarks all open tabs. Browser manufacturers use different shortcuts to trigger accesskeys on each different platform precisely because there's no cross-platform standard. Apple uses Ctrl on the Mac and Alt on Windows in Safari, for example. What's more, each browser resolves shortcut conflicts differently, and this will lead to unexpected consequences for your users. When you bind a keypress to a function in JavaScript that also has a binding as a native browser shortcut...
[Source: the addendum at the foot of John Resig's jquery.hotkeys readme page.] |
|||
|