views:

156

answers:

6

Hi,

update: Got a beautiful app with exclusive shortcuts for every view, all javascript. I'm gonna look into Fogbugz, i like the hovering shortcut-codes, thanks for the reference.


i want to make my site accessible and more usable for visitors. Which keyCodes can I safely use to handle certain javascript actions?

With safely I mean:

  • keyCodes that don't interrupt with default browser actions
    • No direct functionality (like pressing F1 for Help)
    • No indirect functionality (like pressing CTRL+C for Copy)

Or should I prevent default actions from executing?

+1  A: 

Maybe you should take a look at those questions:

http://stackoverflow.com/questions/912018/key-shortcuts-in-web-application http://stackoverflow.com/questions/362727/building-a-keyboard-accessible-web-application

Daniel Silveira
I didn't find the first one myself and that looks like my question. However I was hoping that there was a list of undefined keyboard shortcuts for Firefox and Internet Explorer
Ropstah
A: 

Just stick to letters and numbers.

Here is a link to the shortcuts gmail uses for example:- http://mail.google.com/support/bin/answer.py?hl=en-uk&answer=6594

Just make sure you don't interfere with people typing into form fields.

rikh
How can I use letters and numbers and don't interfere with form input? Is document.onkeydown not triggered when input.keydown is triggered?
Ropstah
+1  A: 

What accessibility do you want to achieve?

Accessibility software like will have their own key-actions.

Different browsers have their own key-actions.

Some are even customisable.

I think you're asking for trouble whatever you do.

Edit: OK so somehow this wasn't clear. Here's what I was trying to say:

Browser's and accessibility software have an unlimited range of possibilities for what key combinations might be used. If you try to catch key-combinations, you will interfere with those somewhere along the line.

Sigh.

joshcomley
SO makes me laugh. My answer is the same as Daniel's, but someone votes mine down...!
joshcomley
That's probably because you didn't get the question. I want to add keyboard shortcuts to javascript functionality thus creating website accessiblity for people that don't have a mouse (or don't want to use one). So i'm not trying to make browser actions accessible (browsers have their own key-actions), but I'm trying to make my website accessible.
Ropstah
Then you clearly didn't get my answer.My point about browsers having their own key-actions was to warn you against interfering with this when you make your own. Firefox can have any number of exensions with any number of key-combinations activating things. If you try and catch key-combinations in your site, you are likely to interfere with that.My answer is no different to Daniel's.You will only make it less accessible to someone else.
joshcomley
Sorry not Daniel's, Galwegian's
joshcomley
@ropstah, there are no "safe" keys that you can use for keyboard shortcuts. There are many different applications that enable accessability, and almost all of them are customised to the individual at hand. Someone who is blind will have different software to someone with a physical handicap, someone with one form of physical disability will have different configurations than other forms of physical disabilities. You want to have your cake and eat it too.
AdamC
+3  A: 

I personally avoid using these keycodes or AccessKeys for a public-facing site, as there is no way to know whether you are conflicting with some predefined shortcuts in users' software like screenreading software, etc.

Galwegian
It's for an intranet, but thanks for pointing it out
Ropstah
Ah, that makes a big difference - I would try to make shortcuts based on the alt key then - you should take a look at the way they do it in FogBugz - http://bugs.movabletype.org/help/topics/basics/KeyboardShortcuts.html
Galwegian
A: 

This may be a tricky problem to solve over the long term, since browsers will sometimes introduce new keyboard shortcuts in newer versions, which may conflict with shortcuts that you may have assigned for use in your application. A couple of such examples that I'm aware of:

  • An old version of the Google Toolbar that ran in Firefox 1 used the keystroke Alt+s to set the focus to the Search field on the toolbar. However, when Firefox 2 was introduced, the History menu was added with an accessor key of Alt+s, which broke the Google Toolbar Alt+s keyboard shortcut. (More info)

  • An old version of the Firefox extension Duplicate Tab used the keyboard shortcut Ctrl+Shift+t to duplicate the current tab. However, Firefox 2 introduced a new feature, "reopen recently closed tab," and assigned that to Ctrl+Shift+t, which broke Duplicate Tab. The author of Duplicate Tab ended up changing the "duplicate tab" shortcut key to Ctrl+Shift+u. (More info)

Jon Schneider
A: 

You'll also be happy to know about the existance of WCAG and WCAG 2.0 from W3 to help you with your accessibility mission.

jAST