bespoke websites icon

Brochure Websites
Advertising your business.

website solutions icon

Innovative Ideas
For your online presence.

Accesskey - What is it, what's it for and should I use it? article By Adrian Rayfield

Last edited: 16.01.2008

What is Accesskey?

Accesskey is (x)HTML code used to provide a keystroke combination giving the user a shortcut or 'hot key' to move to an element.

The accesskey attribute gives focus to the element to which it's assigned. The following elements support the accesskey attribute: A, AREA, BUTTON, INPUT, LABEL, LEGEND, and TEXTAREA.

To code accesskey into your source code you can do so as follows:

<a href="index.htm" accesskey="1">Home Page</a>

Accesskey is a relatively unknown attribute by both developers and users.

Top

A close up of a 'ALT' key

What are accesskeys?

Accesskey is used to provide users with keyboard access and a quick and easy way to move to an element. The W3C have a good and simple explanation of this element:

"This attribute assigns an accesskey to an element. An accesskey is a single character from the document character set. Pressing an accesskey assigned to an element gives focus to the element. The action that occurs when an element receives focus depends on the element. For example, when a user activates a link defined by the <a></a> element, the browser/device generally follows the link. When a user activates a radio button, the user agent changes the value of the radio button. When the user activates a text field, it allows input to that text field."

People who may make use of this accessibility feature are:

Top

Should I use accesskeys?

The WCAG 1.0 guidelines states:

9.5: Provide keyboard shortcuts to important links (including those in client-side image maps),A close up of a 'CMD' key form controls, and groups of form controls. [Priority 3]

For example, in HTML, specify shortcuts via the "accesskey" attribute.

So to comply with WCAG 1.0 AAA you must provide keyboard shortcuts to important links via an accesskey.

Many people tend to think this guideline means that every link needs to have an accesskey assigned to it, this is not the case. Read the guideline again and note the words 'important links'. So this attribute should be used sparingly, carefully and on important links and form controls only.

So what can be used for an accesskey? Any single letter or number can be used, however be aware this may cause conflicts with some browser or assistive devices pre-defined shortcut keys. It is recommended that if you are going to use accesskeys to only use numbers and a select few letters.

The accesskey attribute does have limitations:

In theory, accesskey is a great asset to aid accessibility by giving keyboard access, but in practice it can cause problems.

So do you use it? I would say think about it carefully, way up the pros and cons and if you do use it do so only on important elements. Only use numbers and ensure you inform the user that you have used them by some means (this may include a help page, accessibility statement, title tags etc)

Top

Due to the problems accesskeys can cause, the W3C are dropping this attribute in the next version of the guidelines (2.0) and are replacing it with a more powerful access attribute, this can be seen in the XHTML 2.0 Working Draft (July 22, 2004). Once the final draft of these guidelines is released, it will take browser developers time to implement these changes so accesskey can still be used.

I used to use accesskeys based on the UK Government accesskeys standard:

  1. S - Skip navigation
  2. 1 - Home page
  3. 2 - What's new
  4. 3 - Site map
  5. 4 - Search
  6. 5 - Frequently Asked Questions (FAQ)
  7. 6 - Help
  8. 7 - Complaints procedure
  9. 8 - Terms and conditions
  10. 9 - Feedback form
  11. 0 - Accesskey details

I would inform the user that I have used accesskeys in two ways; firstly, with the title tag on the link/element as follows:

<a href="index.htm" accesskey="1" title="Back to our home page. Accesskey 1">Home Page</a>

Secondly, I would list the accesskeys used in an accessibility statement.

So, to conclude,

It has to be your decision whether or not to use accesskeys but I hope you can now make an informed choice.

Note: (added 16.01.2008) We have not used accesskeys now for some time due to the conflicts it can cause, many tests have been done and found that almost every key has the potential to conflict with other software that may be in use by the viewer such as screen readers. WATS.ca carried out one such test in 2002 and in WATS.ca findings concluded only 3 keys were not already assigned.

Article written and copyright held by Adrian Rayfield of Rayfields Accessibility © 2006.

Top

Did you find this article / tutorial useful, please give us your comments.

Required fields marked with a *

Your comments:

Was this article / tutorial useful?:


Anti-spam questionHelp?

This question must be answered correctly before sending form.
4 + 0 =

© Copyright 2005 - 2011 Hazel Rayfield All Rights Reserved
| Home | Articles | Accessibility | Site Map | Contact Us |

Blog icon Twitter icon Facebook icon Linkedin icon