| Depr. | Version |
|---|---|
| No | HTML 4 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ | CH2 |
|---|---|---|---|---|
| Full | Full | Full | Full | None |
Syntax
Description
The accesskey
attribute allows the user to activate a control on a page using a keyboard
shortcut. This may save time for users who would otherwise need to tab
through a series of form controls or move the mouse to get to the desired
link. The key combination that activates the link to which the
accesskey is applied varies depending on the
platform and browser combination. For IE/Windows, users press Alt +
accesskey, while Firefox/Windows users press Alt +
Shift + accesskey; users of most Mac browsers press
Ctrl + accesskey; in Opera, pressing Shift + Esc
displays a list of links for which accesskey
attributes are defined, allowing users to choose the key they want to
use.
Generally speaking, browsers
don’t indicate that an accesskey attribute is
defined for a form control, and this lack of discoverability is a problem.
The most common method for indicating the accesskey
value is to place it in a title attribute of the element to
which it’s applied. However, for this approach to work, the user must
mouse over the element in question. You may want to state the
accesskey value in some other way—for
example:
<form>
<button accesskey="s" title="Accesskey = s">I am
<em>really</em> sure I want to proceed [accesskey = s]</button>
</form>
Admittedly, this may not be practical
or cosmetically pleasing, but without this hint, the user may never
realize that an accesskey is available.
Example
This code assigns the
accesskey for this button to the
"s" key:
<form>
<button accesskey="s" title="Accesskey = s">I am
<em>really</em> sure I want to proceed</button>
</form>
Value
This attribute takes as its value a single character, which can be numerical, alphabetical, or even a symbol.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | None |
There is some variety in the way that the
accesskey is activated. The biggest problem with
this attribute is that the keystrokes you’ve defined may clash with other
technologies. For example, a user may have assistive technology (such as a
screen reader or screen magnifier) that shares keystrokes with those that
you’ve defined in the accesskey attribute. In
addition, different language browsers use different “accelerator keys” for
their own menu options, and these may also clash with the access keys
you’ve defined. In such cases, the accesskey may
not work as you intended for all users, and as such, many web standards
advocates strongly discourage its use. However,
accesskey can have a role in documents that are
used in controlled environments, such as intranets or for point-of-sale
environments, in which you know exactly which browsers and languages the
users can access. In such cases, using a standard set of
accesskey attributes may be of great benefit.
User-contributed notes
There are no comments yet.