RE: ACCESSKEY

When using tabindex, I recommend numbering by tens, i.e.:

10, 20, 30, 40...

That way if you need to insert controls later, you don't have to renumber
your whole page.

As for accesskeys, as David Woolley (I think) pointed out, you don't want to
put them on dozens of links, just the most important ones. So 26 + 10 should
be enough. The problem I run into is not running out of accesskeys, but
choosing the right one. I think that it's easiest if the accesskey
corresponds to the first letter of the link label (e.g., "a" for "About
Us"), but that often requires careful selection of link labels to avoid
duplicates.

A couple of years ago I built a site in which I used <span> to underline the
shortcut key letter in the link label. The problem with that was that
accesskeys only worked on IE4 at that time, so I ended up using a browser
sniffer in JavaScript and a short script to underline the letters only in
IE4+... no sense confusing people. Then I discovered that pwWebspeak was
confused by the span tags and would pronounce the letters as separate words:
C ontact Us, A bout Us, S ite Map, etc. It was even worse when the accesskey
wasn't the first letter of the word. So I abandoned that technique.

I generally use accesskeys on any links on the navigation bar and try to
choose link labels so the accesskey is the first letter of the label. For
the "persistent" links - the ones that are on every page - I use numbers and
number them in sequence as they appear on the page. Most of my sites are
dynamically served, so I offer users the ability to turn shortcut keys on
and off (thus solving the problem of overriding the browser's shortcut
keys). I generally use K or J as a toggle to turn accesskeys on and off.
When they're on, I use X as a toggle for an index of keys at the bottom of
the page. This index is generated automatically as the page is built, so it
always reflects only the keys available on that page. Finally, I use 9 as an
accesskey for the list itself (to scroll to it).

So on one of these pages, the user can hit Alt-J (or equivalent) to turn on
accesskeys (they are off by default). Then hitting Alt-X will reveal an
index of the keys (and scrolls the page to them). Once these are on, they
stay on until the user turns them off (assuming session control via
cookies). At any time after that, the user can hit Alt-9 to scroll to the
index if she forgets which key is which. So at most, any link requires only
two keystrokes (or keystroke combinations).

On pages with long lists of links, I use tabindex instead. And I never use
accesskey for links in the text - only for links in navigation bars.

On forms, I generally use tabindex since I've usually used most of the
accesskeys for the links. If accesskeys were case sensitive (they aren't on
any browser I've seen), it might be worth establishing a precedent - say,
uppercase letters for form inputs and lowercase for links. But even then,
the labels of form inputs would be difficult to wrestle into shape to
prevent duplicate letters (and if you aren't using the first letter of a
label, then you have to come up with some other system to let the user know
what the shortcut key is).

Hope this helps.

Charles Munat
Seattle, Washington

Received on Thursday, 5 April 2001 16:20:04 UTC