The use of "access keys", a guide for webmasters

August 10, 2006 | Published in: Accessibility, Standards & SEO | Tags: , , 4

Help keyAccess Keys have been around since HTML 4.0, and have many accessibility benefits, they are also part of the WCAG accessibility guidelines. However despite this they are uncommon, and fairly unknown; few
webmasters choose to incorporate them in their websites.

This article attempts to describe what access keys are, their benefits and implications, and practical uses of them in your web sites. Using access keys is easier than you may of thought!


What is an access key?

An access key is a HTML attribute that allows users to navigate to a certain link via the keyboard, rather than clicking. Its primary goal is to increase accessibility and usability in web pages for users who find using a mouse difficult.

Accessibility benefits

Access keys mainly benefit users with motor difficulties (users who find moving difficult, and have difficulty with pointing devices such as mice). By providing navigation with access keys, users have the option to perform a simple keystroke to navigate links.

On a PC, access keys are normally used by holding ‘alt’ and pressing the access key.

On a MAC, access keys are normally used by holding ‘ctrl’ and pressing the access key.

WCAG

Providing access keys is part of the WCAG priority 3 guidelines (here), in which it states that important links should have a keyboard shortcut.

Provide keyboard shortcuts to important links (including those in client-side image maps), form controls, and groups of form controls.

[Priority 3] (Checkpoint 9.5)

The WCAG also provides more detail on this checkpoint:

Keyboard access to active elements of a page is important for many users who cannot use a pointing device. User agents may include features that allow users to bind keyboard strokes to certain actions.

Priority 3 checkpoints are not essential, but will aid your visitors, so are worth an attempt.

Coding the access keys

Here is the bit most of you will want to read, the access key code!

When using access keys in links, the ‘accesskey’ attribute goes inside the tag.

<a accesskey="key">Link</a>

Replace key with the key you wish to set up as the access key. *Please note, this could interfere with the browsers shortcut keys (see browser implications below).

So that’s the code, if you’ve successfully made an access key give yourself a pat on the back.

Practical uses in navigation

So how can we use these access keys in our navigation to aid users? Here is a simplified version of Blue Anvil’s navigation, note the use of access keys in the links.

<ul><!-- list items -->
	<li><a accesskey="1" href="index.php">Journal </a></li>
	<li><a accesskey="2" href="/services">Services</a></li>
	<li><a accesskey="3" href="/tag/portfolio">Portfolio</a></li>
	<li><a accesskey="4" href="/about">About</a></li>
	<li><a accesskey="5" href="/contact">Contact</a></li>
</ul>

So now (in windows) the user can press alt and the access key to navigate to my main sections:

  1. Journal
  2. Services
  3. Portfolio
  4. About
  5. Contact

Sites that use access keys – some examples

Larger sites usually do sometimes use access keys, the best example I could find being the BBC:

www.bbc.co.uk – very accessible, uses the following:

  1. go to Access Keys documentation page
  2. go to bbc.co.uk Home page
  3. skip to main content of current page (for non-visual browsers)
  4. go to bbc.co.uk Site Map page
  5. go to bbc.co.uk Search box

Simple, yet effective. But now we need a way of showing the user that the access keys exist, read on.

Making access keys known to the user

Provide suitable documentation

Provide the user with a quick guide to the accessibility features of your site, this is just so the user can find out, and be aware, about features you have implemented. You can see my help guide by looking at the very top of the page, ‘help & accessibility’.

Labelling

Simple labelling can tell the user your access keys and will help them identify that your site features them.

If you are using letter access keys you could underline the access key letter.

If you are labelling with numbers you could give it a different style/look or underline it also.

To do this, the most ‘browser safe’ way would be to use simple spans and css. Lets look at my earlier blue anvil code, but first add a numeric label to show the access key (like you see on the site already).

<li><a accesskey="1" href="index.php">1 Journal </a></li>

Now my ‘journal’ link is shown as being ‘1′. Now lets add a span and style the link.

<li><a accesskey="1" href="index.php"><span class="key">1</span> Journal</a></li>

Now the access key is surrounded by a span, with a class of key, we can apply style in the css file. Lets add a style to underline it. This code goes in the stylesheet:

.key {   text-decoration:underline;  }

And that would be it, access keys would be displayed as underlined. *Extra: for you fussy people who don’t like spans (Anthony), you can use the em tag.

<li><a accesskey="1" href="index.php"><em>1 Journal</em></a></li>
a em{   text-decoration:underline;  }

If you are feeling adventurous you could use css 2 pseudo elements for the first letter which keeps content and style separate, however I find this way less appealing. See ‘a list apart’ article on access keys for more information on using pseudo classes (ALA – Unlocking hidden navigation).

Labelling sensibly

Obviously, the label you use will affect usability. What would be the point in having the ‘home’ link as access key z? Use a relevant key. So for ‘home’ the best letter would be ‘h’ (of course you could still use a number like me).
Also if you were using numbers, on for instance a navigation bar, don’t jumble the order of access keys, keep them in numeric order and keep it simple. e.g. 2 home 5 services = bad, 1 home 2 services = good.

Browser implications

Despite being around a long time, their are still issues related to access keys, especially in older browsers.

Browser support

Access keys are supported by:

  • IE 4+ (PC)
  • IE 5+ (MAC)
  • Firefox (pc and mac)
  • Netscape 7+
  • Safari/omni web (MAC)
  • Opera (version 7+ ?)

Alternative access key execution keys

Different browsers have different ways of executing access keys, the main browsers are outlined below:

  • IE (PC, including IE 7) – Hold alt, press access key, release, press enter.
  • IE, safari (MAC) – Hold ctrl, press access key
  • Firefox, Netscape – Hold alt, press access key.
  • Opera – Hold shift, press escape, release, press access key.

Shortcut key interference

Access keys can sometimes interfere with other programs that use the same key, or the browsers own shortcuts.

This includes certain screen reader software (e.g WindowEyes).

Because of these limitations, I tend to only use numeric access keys, as application shortcuts dont use them as much.

List Apart states:

Windows users will find that accesskeys take precedence over application commands, which can still be accessed from the keyboard by first typing the menu shortcut key (usually ALT) followed by the letter corresponding to the desired menu item.

ALA – Unlocking hidden navigation

So just to be sure, test your access keys in the main browsers before going live, just to make sure they don’t appear to be interfering with anything.

Other uses of access keys

This article has focused on access keys for links, but this is by no means their only use!

The over main usage is with forms/fields.

They can be applied to:

  • Buttons
  • Inputs
  • Labels
  • Legends
  • Text Areas

Code example

An access key in a label:

<label for="field" accesskey="f">Label</label>

Now by pressing (in windows, firefox) alt and f, the users cursor will jump to the text field the label points too, and they can add their input. This makes using forms a lot more accessible, just make sure the user is aware of this feature.

Lastly, access keys can be used in the ‘area’ tag (used for image maps) to provide keys for links within the element.

Closing statement

So there you have it, a quick guide to access keys, I hope it was useful, and I hope they help your users if you implement them.

Thanks for reading, please leave a comment!

Found this post useful? Why not buy me a coffee!

Related Entries

4 Responses to “The use of "access keys", a guide for webmasters”

RSS feed for comments on this post.

  1. Anthony says:

    Good article – Access Keys seem to be slowly taking off and I wonder if and how they will be implemented in the revision of WCAG.

    Comment made on February 9, 2007 at 5:41 pm

  2. Mike Cherim says:

    While I love the idea of accesskeys, I recommend they not be used at all unless a script is provided like we did at Accessites.org allowing users to set their own. We used to use numbers 0-5 thinking they were safe choices (letters are trouble) but we learned differently. One day a fellow was using our contact form and had a chanracter in his name that required he type a character entity so he used Alt+0 to make that so. Next thing he knew he was on another page. Fortunately for us he reported it. That’s when we added the script.

    Comment made on February 9, 2007 at 5:42 pm

  3. Mike J says:

    Hmm interesting, I’d never even considered the inpact on character entitys.
    But the script idea is good, just a bit of php and a cookie I take it?
    Thanks for that.

    Comment made on February 9, 2007 at 5:43 pm

  4. Tom says:

    Very good article, I agree with Mike Cherim about the script.

    Comment made on February 9, 2007 at 5:44 pm

The comments are closed.

About this site

Blue Anvil is the online web design journal & portfolio of , a web designer from Norfolk, England. Read More »
ThemeSlice
  • Featured work - More

    • Beefjack
    • Integrity
    • theotaku.com
  • Latest Tweet - More

    • New blog post: MiniCard 1.1.7 Update http://blue-anvil.com/archives/minicard-1-1-7-update/
  • Out of the blue - More

    • MiniCard 1.1.7 Update

      I have just uploaded 1.1.7 of MiniCard here and to the WordPress theme directory. This updates includes:

      • New networks; xing, gowalla, yelp, foursquare, mobileme, google buzz
      • A way to change link text and define multiple links of the same network
      • A way to define your own custom links + icons
      • Improved admin panel

      Hope you like it, and don’t forget you can show your support by purchasing the premium pack from here.

    • Switched: From Shared to VPS

      It’s been about two weeks now since I made the transition from a shared reseller hosting account to a VPS (Virtual Private Server) account – impressions so far, excellent performance but fiddly to configure.

      The reason I wanted to change from shared hosting was the fact the server was always being hacked (even though ALL my scripts were secure), there was frequent downtime, support blamed me for problems every time, and it was slow as hell.

      Those used to a shared hosting environment would probably not know where to start when faced with configuring a VPS. Luckily, a lot of it was pre-configured when I received my account – certainly some of the major security holes were patched. I was not satisfied with those however. As a victim of hacking in the past (previous host swears it was not there fault, something I don’t believe) I took extra care to secure it as a much I could – configuring brute force detection, the firewall, installing mod security (excellent rules for that here: http://www.atomicorp.com/wiki/index.php/Atomic_ModSecurity_Rules) and going though multiple guides (like this one: http://www.webhostingtalk.com/showthread.php?t=468168) with a fine-tooth comb.

      The result? My pages are loading at least 6 times faster, I have had no down time (or at least have not noticed any), and I feel in control and happy. No longer am I at the mercy of shared hosts :)

      If your interested, I chose ServInt as my provider as they offered a great deal, as well as being a managed service (so I’m not on my own if I screw things up). I was tempted by the bells and whistles of Media Temple, but felt the ServInt service was better value.

    • Download Monitor 3.2.2 Maintenance Release

      Download Monitor has received some more love and has been updated. Here’s the change log from the new version:

      • Small bugfix in uploader.php – cat ID
      • Changed stats graph calculation – thanks lggemini
      • Changes to headers in download.php to avoid caching
      • File Browser fixes – $root was clashing with something….
      • exclude_cat works in all sections of download_page now
      • Removed hardcoding of /uploads/
      • Added action to download.php – should be able to use it to stop a download if you want – maybe limiting downloads per day or something? Whatever you want…
      • Made it so if you post new file on ‘edit’ screen, the post date is updated.
      • Fixed the ‘blank meta’ section which blanks out custom field values when nothing is set.
      • Moved ‘allow_url_fopen’ check.
      • Someone said downloads don’t work with spaces in the name. They do! Wasting my time sonny…
      • All work and no play make jolley a dull boy
      • Had to rename capabilities so they work. Apologies if you have to set this up again! Cheers to Mark Dingemanse.
      • {category_ID} custom format tag added. Useful if you want to send someone to its category on the DL page I guess. Also added {category_other} so when no category is set “other” is shown – this is because the download page can show an ‘other’ section if you want it to.
      • You can now manually edit the post date on the edit download screen.

      If you have edited capabilities for download monitor user permissions, you’ll have to again sorry! This is because I named them too long. Also, you should check your forced downloads still work because there was a logic error meaning they may not have been forced after-all…

      Enjoy.

    • Mahousive update to Download Monitor (3.2)

      Today I completed the update for the Wordpress Download Monitor Plugin – many tweaks, fixes, and features added. There were no changes to the database structure so people upgrading should be fine. Here is the list from the change log:

      • {user} tag added for custom formats
      • ‘autop’ option fix
      • Download page buttons applied with CSS so they are easier to customise/translate.
      • Fix for pagination bug after editing a download
      • Category output fix on edit downloads screen
      • Category urls on download page use ID rather than name to prevent errors when cats have the same names.
      • exclude_cat added to download_page shortcode
      • Localised ‘hits’ ‘date’ ‘title’ on download page
      • Option to disable the download logging
      • Read file ‘chunked’ some people found large files were corrupted so this should help (fingers crossed)
      • Added show_tags option to download page – displays x amount of tags on the download page.
      • File Browser root setting and download.php logic/mime types modified thanks to Jim Isaacs (jidd.jimisaacs.com)
      • Interface Improvements
      • Bulk edit categories, custom fields, tags, member only downloads
      • Added roles for download monitor admin – should be able to use with a role manager plugin if you want anyone other than admin to access the admin section e.g. http://wordpress.org/extend/plugins/capsman/
      • Change redirect after add
      • Edit Cat names/parents
      • Dedicated tags and thumbnails fields (they still use meta table though)

      And yes, those category link bugs are fixed at long last, and you can edit category names finally. Phew!