Day 15: Defining keyboard shortcuts…

Day 15: Defining keyboard shortcuts.

One of the least known features of HTML is the accesskey attribute for links and forms, which allows the web designer to define keyboard shortcuts for frequently-used links or form fields. On Windows, you can press ALT + an access key; on Macintosh, you can press Control + an access key. If the access key is defined on a link, your browser will follow the link; if defined on a form field, your browser will set focus on that field. Internet Explorer has supported access keys since version 4, Netscape since version 6. Older browsers simply ignore them, with no harmful effect.


While there are no standards for which keys should be assigned to which features, here are some commonly-used keyboard shortcuts:



Access key 1
Home page
Access key 2
Skip to main content (the navigation bar skip link)
Access key 4
Search box
Access key 9
Feedback

Who benefits?



  1. Jackie benefits. When JAWS reads a link that defines an accesskey, it announces the access key as well. For example, the link Home page would be read by JAWS as “link: Home page, ALT + 1”. Jackie can focus on the link by pressing ALT+1, then follow it by pressing ENTER.
  2. Bill benefits. Since Bill can not use a mouse effectively since his stroke, he relies on keyboard navigation and keyboard shortcuts to move around the page. Access keys are an excellent way for him to jump to common or frequently-used links. Bill can type ALT+1, and Mozilla immediately follows the link that defines accesskey=”1″. (Note: Mozilla does not announce access keys, which raises the question of how Bill would discover what they are. We will discuss this in a future tip.)

How to do it: home page link




  • Movable Type: The default template does not have a link to the home page, so you should make your site name into a link, and give it an accesskey. Search your template for <$MTBlogName$>, and change it to this:



    <$BlogTitle$>


How to do it: skip navigation link


Do you have a link to skip over your navigation bar? If so, give it an accesskey=”2″.




How to do it: feedback link


Do you have a link to a feeback form, or a link to your email address? If so, give it an accesskey=”9″.



Email me


Note: Radio weblogs generally have a link to a feedback form (the little envelope icon), but the link is generated by a macro, so you will not be able to add an accesskey to it.


How to do it: search box


Do you have a search function on your site? (You should; we’ll discuss this in a future tip.) If so, add an accesskey=”4″ to the input box in the search form. For example, this is the input box I use on my site:



accesskey=”4″ type=”text” id=”q” name=”q” />


Be sure to include each accesskey on each page of your weblog; make these changes to all your relevant templates.


Further reading



[dive into mark]