Giving the user control over accesskeys

One of the major drawbacks to the well-intentioned idea of accesskeys is that they can conflict with shortcut keys used by web browsers or operating systems. Whether the specification or browser makers are to blame for that is another story, partly discussed in Accesskey problems remain in XHTML 2.

The normal way for a website to define a shortcut key is to use the accesskey attribute on an element that may have such an attribute, specifying a character that becomes the shortcut key in combination with one or more other keys as implemented by the browser (typically Alt in Windows and Ctrl in Mac OS X).

That doesn't leave the user with any way to change the accesskeys defined by a website. Well, now there are at least two ways that web developers can offer that possibility.

Gez Lemon and Rich Pedley have created a PHP class (an ASP version is also available) that can be used to let users define their own accesskeys. The PHP code is described and demonstrated in User-Defined Access Keys.

If you don't like the idea of using a server-side script to make accesskeys user editable, Jacques Distler describes a JavaScript-based method in Editable Accesskeys.

Not long after that, Gez responded by creating a Greasemonkey User Script to Manage Access Keys.

Both methods have their pros and cons, so I'm not going to say one is better than the other. If you want to offer your visitors the ability to define their own accesskeys, read up on both of these methods and then decide which is most suitable for your needs.

Posted on January 27, 2006 in Quicklinks, Accessibility, JavaScript