views:

193

answers:

7

Hi,

I didn't see the question yet. Every browser has different native keyboard short-cuts. Did someone already tried to figure out which one free / safe to use if we want to add some spicy stuff to our web-app?

Thanks in advance.

+4  A: 

The short answer is:

Disappointingly, our research discovered that all but 3 keys were previously "claimed" by one technology or the other:

* AccessKey / (slash)
* AccessKey (backslash)
* AccessKey ] (right square bracket)

This is explain in this article:

This wikipedia article give a good general introduction into this subject:

rtpHarry
Your answer focuses on access keys. I was more thinking more general: shortcuts. I don't especially need to target every browser. The 5 majors one are sufficient. For example Opera uses Ctrl+key as main combination, leaving almost all Alt+Key "free to bind". As different browsers uses a different main shortcut activation key (Ctrl in Opera), I can easily imagine to also use a different key to bind shortcuts to. i.e Alt + Key in Opera and Ctrl + Key in browser_2 and Ctrl + Alt in browser 3.
Savageman
A: 

Some more informations:

I don't especially need to target every browser. The 5 majors one are sufficient. For example Opera uses Ctrl+key as main combination, leaving almost all Alt+Key "free to bind".

As different browsers uses a different main shortcut activation key (Ctrl in Opera), I can easily imagine to also use a different key to bind shortcuts to. i.e Alt + Key in Opera and Ctrl + Key in browser_2 and Ctrl + Alt in browser 3

Savageman
+4  A: 

If you only need keyboard shortcuts outside of form elements having focus, I would use plain letters (no shift/alt/ctrl/etc.). Regular characters are only important to the browser if a form element has focus. Otherwise they're ignored.

For example, if you have paginated content, "p" could be previous and "n" could be next.

(Not sure if this would completely solve your problem because this won't work when a form element has focus.)


Based on your comment (the focus will be inside a textarea), I would suggest a single letter chosen for each action with a different ctrl/alt/shift combination per browser. Most people only use one browser, so for each user to learn just their own combination isn't a big deal.

So, for example, ctrl-alt-n in one browser might be the same as alt-n in another.

The first thing I would test, though, is shift, because most built-in combinations don't use one, but I don't know if the combos are always case-insensitive. Also watch out for OS-specific combos.

Here's what I've found mostly available so far:

OS X    - FF/Safari/Chrome - ctrl-[key]
Windows - FF/IE            - ctrl-alt-[key]
Matt S
Yeah, good point! I forget to notify this. Usage is some sort of Word editing, so inside a textarea. Let's say I want to put the selected text in bold with a key combination (ctrl+b).Except b won't work in Opera, because it opens the bookmark sidebar.
Savageman
Single letter shortcuts will be very annoying if 'find as you type' option is switched on. It allows to search text on the page without pressing `Ctrl+F` or `/` and I know lots of people having it enabled.
hudolejev
Yes, that's how I'll do it. But that doesn't help me choosing between those 2 keys (ctrl/alt) for each browser, which was kind of the goal of my question.
Savageman
You gave me the best answer among other people, I reward you the bounty. Still, if you can complete your answer, don't hesitate. ;)
Savageman
Matt S
+2  A: 

My recommendation is to change it depending on the browser. The fact is, there are so many browsers out there, I think you'd be hard-pressed to come up with a shortcut scheme that won't break on at least one popular browser.

You could change the shortcut setup based on the browser and also change the instructions specifying which shortcuts to used based on the user's browser.

Ideally, you'd make the shortcut as intuitive as possible (ctrl+x, or alt+x etc) without actually interfering with the browser.


Edit: Alternatively if you're comfortable overriding default functionality, maybe use this: http://www.openjs.com/scripts/events/keyboard_shortcuts/

When you specify a shortcut with it, the browser will ignore that shortcut, and you can use it in your app (like gmail does with ctrl+s, for example).

Cam
Targeting only popular and recent browser is fine for me. IE 8 / FF 3.6 / Chrome 4 / Safari (insert the last version number here). I can deal with Opera myself. :-)I planned to use MooTools.More.Keyboard interface. I just need to choose between "ctrl", "alt", "ctrl+alt" for the 4 browsers I support.My question was to actually prevent overriding default functionality.
Savageman
Then I suggest the first half of my answer. Choosing the shortcuts based on the user's browser/os might be your best bet, especially since different browsers use different shortcut buttons on different os's (I think FF for example). You could determine the browser/os serverside and pass on the appropriate js accordingly. That's how I'd do it; to ensure max compatibility all-around.
Cam
Yep, thank you. That's how I'll do it (only client-side, I don't need the server-side detection). My concern is on which key to use for which browser.
Savageman
You actually should also inspect the language used. For example trying to get an `@` inside an answer triggers a blockquote in SO for german keyboard layouts. @ is the third option of the Q-key, pressing `Alt gr + q` is the same as requesting a blockquote.
ablaeul
+1  A: 

For Mac users you want to definitely go with ctrl as alt is used to type many different characters and command is the default action key which the browsers use. I'd avoid combos that use basic emacs style shortcuts as well (some users use them like Ctrl-k which SO manages to screw up ;) though these are less known and so possibly usable.

For windows it's more complicated - and I don't have a win box to test it myself.

Jakub Hampl
You understood my problem really good. I was thinking I expressed it badly. I still need to find the keys for Windows users, but you perfectly answered my question for Mac users. :-)
Savageman
+1  A: 

Screen readers (JAWS, NVDA, ...) already use the whole keyboard, dead keys included (I'm exagerating a little but it's competing with Adobe Photoshop in terms of number of keyboard shortcuts used).

So if you want to support screen readers and other assistive technologies, you should use ARIA and especially role="application". That'll avoid conflicts between your application and the default functioning mode of screen readers in web pages. One drawback is that you've got dozens and dozens of pages to read ...

Introduction à WAI/ARIA (traduction en français) (our common native language, isn't it SDZ/zC? ;))

EDIT: One of the way to solve conflicts is letting the user define and modify his own shortcuts.

Felipe Alsacreations
Hey, thank you for the answer. Am I famous? Do you know me? :d I'm from zC yes (easy to find on my profile).Anyway, I don't really know much on WAI/ARIA. I'll probably dig into it for my personal knowledge, that seems a bit disproportioned for what I want to achieve.The idea of letting the user configuring his own shortcuts looks good, but I don't really know if I want to use it. It can be kind of hard to manage. My thought is more to give good shortcuts that don't need configuration.Your ideas are new and innovative in this topic, I like it! Thanks!
Savageman
+1  A: 

For a pragmatic solution, copy Google. They have keyboard shortcuts in Gmail (and probably other products) that do a pretty good job of avoiding browser shortcuts.

Ryan Thompson