Accesskey standards

来源:互联网 发布:数据分析师培训多少钱 编辑:程序博客网 时间:2024/05/16 14:40

One of my goals for Clagnut is to make it accessible beyond good alttags and valid code. It currently passes WCAG 1.0 Priority 1 and Section 508. To achieve this, a skip navigation link (skip nav) is required. To make skip nav (and other essential navigation) more effective, we should provide keyboard shortcuts through the accesskey attribute. For example:

<a href="#content" accesskey="2">skip nav</a>

This allows visitors to press ALT+2 or CTRL+2 (on Windows and Macs respectively) to move focus straight to the anchor in question. Keyboard shortcuts can also be applied to form controls by adding accesskeyattributes to input tags in the same way.

It’s also helpful to add keyboard shortcuts for other important parts of the site, such as search, help, home page and the page which lists the keyboard shortcuts. It struck me that there should be consistency in access keys across the Web. I couldn’t find any mention of standards or suggestions on theSection 508 or WAI sites, so I attempted to see if a de facto standard has been adopted none-the-less.

The UK Government provides accessibility guidelines to which all its websites should comply. These guidelines state:

UK Government ShortcutsAccess keyTargetSSkip navigation1Home page2What’s new3Site map4Search5FAQs6Help7Complaints procedure8Terms and conditions9Feedback form0Access key details

WebAIM provides similar shortcuts:

WebAIM ShortcutsAccess keyTarget1Home page2Skip navigation3Printer-friendly version4Search

These almost match with the access keys used by Mark Pilgrim (accessibility evangelist):

Dive Into Mark ShortcutsAccess keyTarget1Home page2Skip navigation4Search0Access key details

And finally, the accessibility magazine Made For All uses a few different shortcuts:

Made For All ShortcutsAccess keyTarget1Home page2News3Previous issues4Resources5About0Access key details

So there’s a fair bit of overlap between sites. The use of numbers is sensible as software often uses letters for its own shortcuts, particularly for access to the command menu. Letters also make more sense when dealing with forms (think shortcuts in dialog boxes). So the main bone of contention appears to be skip nav. Here’s a few samples:

Skip Nav Shortcuts Across the WebShortcutWeb Site2Dive Into Mark2Zeldman2WebAIM9Cinnamon InteractiveCClagnutCAccessifySUK Government

The consensus of opinion from this little lot is ‘2’. I’ve made the change accordingly and added more keyboard shortcuts to other parts of the site – see the new accessibility statement. I’ve also made my DHTML site contents menu a bit more keyboard friendly by adding an onfocus event handler to display it.