The accesskey Attribute

You may be aware of an attribute named accesskey. It was added to HTML 4 as an accessibility feature and was intended to associate a given keystroke with a control in the document.

So why, then, aren’t we recommending it? It’s complicated. So complicated, in fact, that each major browser implements accesskey differently.

If that wasn’t confusing enough, there are more problems. In Internet Explorer (IE), you press the Alt key and the specified key to activate the accesskey. But IE already uses Alt+key combinations in its interface: Alt+F for the File menu, Alt+H for Help, and so on. On top of that, those keystrokes change from language to language. So really, if you want to ensure that your accesskeys will actually help, you’re ultimately limited to numbers. The British government specified a standardized list of controls, which is helpful but not broadly implemented, as is the fate of nearly every ad hoc content standard.

And further, the accesskey’s capabilities are different from browser to browser. For example, an accesskey on a link in Firefox 3 and Opera 9.5 follows that link, while it only focuses on that link in IE 6 and 7. The differences are summarized in Table 5-1.

Table 5-1. Activating accesskeys—differences in browser behavior

 

Shortcut key(s)

Activates or focuses controls?

Internet Explorer 6

Alt+key

Activates

Opera

Shift+Esc, key

Activates

Firefox 2

Shift+Alt+key

Focuses

Firefox 3

Shift+Alt+key

Activates

Safari 3 for Windows

Alt+key

Focuses

Safari ...

Get Universal Design for Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.