This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13576 - Extend accesskey="" to accept key names (e.g. accesskey="home")
Summary: Extend accesskey="" to accept key names (e.g. accesskey="home")
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P3 enhancement
Target Milestone: Needs Impl Interest
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
Keywords: a11y
Depends on: 13555
  Show dependency treegraph
Reported: 2011-08-03 05:17 UTC by Greg Lowney
Modified: 2019-03-29 19:24 UTC (History)
11 users (show)

See Also:


Description Greg Lowney 2011-08-03 05:17:46 UTC
Users who rely solely on the keyboard benefit greatly from having a great number of keyboard commands (accesskeys, hotkeys, etc.) defined by content, add-ins, user settings, etc. Unfortunately the design of the accesskey attribute currently limits each shortcut to a single Unicode code point, to which the user agent may arbitrarily zero or more modifier keys. This severely limits the number of shortcut keys available at one time and restricts the ability of components to assign meaningful and easily remembered keybindings. This is particularly important for web-based applications such as word processors which would want to define a large number of keys, and also for accessibility aids such as browser add-ins that add shortcuts for all operable elements on a page. HTML5 should correct this by allowing components to take advantage of a wider range of keyboard inputs as shortcuts. 

Aspects of this discussed below include: (a) allowing sequences as shortcuts; (b) enabling unmodified keys as shortcuts; and (c) allowing non-character keys as shortcuts; and (d) specifying detailed shortcuts.

A. Allowing sequences as shortcuts

Allowing key sequences to be used as commands greatly increases the number of keyboard commands that can be used, as well as the ability to make these command mnemonic.

    * Use case: Jemiah is a keyboard user who wants to make her work as efficient as possible. She configures her Web-bases word processor to set up shortcut keys for the dozens of the built-in commands and macros she uses frequently, especially those that would normally take many keystrokes to carry out. However, she quickly runs out of good keystrokes, both because of the sheer number and because she needs to keep them mnemonic in order to easily remember them. Therefore she uses key sequences so she can group related commands together with the same prefix. For example, she uses Ctrl+R as the prefix for all the commands dealing with revisions, with Ctrl+R followed by S to show revisions, Ctrl+R followed by H to hide revisions, Ctrl+R followed by A to accept revisions, Ctrl+R followed by R to reject revisions, and so forth.

    * Recommendation: Facilities to establish and adjust keybindings should allow content, add-ins, and the user to bind commands to key sequences as well as single keys and key combinations. HTML would let the author specify preferred keyboard inputs for accesskey and the like including key sequences, such as accesskey="ctrl+r a" for Ctrl+R followed by the letter A.

B. Allowing unmodified keys as shortcuts

Some components use unmodified letters, numbers, and punctuation marks as keyboard command. This can be handy for users who want to make keyboard input as efficient as possible, including some users with disabilities, but for other users with disabilities it can be a significant problem because everyday text input can trigger a large number of seemingly random actions if it's entered in the wrong context. Therefore user agents should be permitted to make this available as a user option.

    * Use case: Reggie finds it difficult to press key combinations, and even though many platforms provide the StickyKeys feature that lets her simulate them, she wants to author her own web site so that the shortcuts on the pages are accessed with single keys rather than key combinations.

C. Allowing non-character keys as shortcuts

Allowing non-character keys such as F12 and Del to be used as shortcuts significantly increases the number of keys and key combinations available. Currently non-character keys such as F12 cannot be assigned as accesskey shortcuts, as it can only be keys equating to single Unicode code points per 7.4.3 Processing model.

    * Use case: Jeanine is developing a Web app and because most of the normal character keys are taken, she wants to have the F12 key activate the "Exit" link on the page, and Shift+F12 activate the "Save and Exit" button.

    * Recommendation: Provide a way to use keys that cannot be represented as a single Unicode code point. For example, define keywords such as "del", "num-del" and "f12", and allow their use in the accesskey attribute along with normal Unicode characters (e.g. accesskey="f12 del d").

D. Specifying detailed shortcuts

Today's accesskey attribute is a single Unicode character, and it's up the browser to decide which whether that character will be used or another substituted, and what modifiers if any are required (e.g. accesskey="s" might map to Ctrl+S at one time and Alt+Shift+S at another). That may make sense for access keys (e.g. S or Alt+S to press the Save button) where the user agent is trying to emulate behavior of the platform, but it is an unnecessary limitation for hotkeys (e.g. keyboard inputs mapped to commands that may not be associated with a specific element).

When defining hotkeys developers of Web apps and authors of documents should be able to assign more specific keys, such as actually requesting Ctrl+I for one a frequently used command and Ctrl+Shift+I for another less frequently used. This would let them assign shortcuts in a way that is more meaningful, both in terms of grouping and being easier to remember. For example, a page for reading email could assign shortcut Ctrl+R to the Reply button and Ctrl+Shift+R to the Reply All button, Ctrl+J to the Forward button and Ctrl+Shift+J to the Forward As Attachment button, and so forth. (Of course any specific key combination may already be used by the host or another component in the system, and some keys may not be available on the user's system, so the browser would either treat these as hints to be modified as needed or else the page's script could negotiate with the user agent as described elsewhere in this document.)

    * Use case: Roger is using a Web-based email client that has a row of buttons for things he can do to the selected message. The author wanted to make keyboard usage as efficient as possible and minimize the number of keystrokes that users such as Roger need to enter, so they assigned easily typed keyboard inputs to the most commonly used commands and more complex inputs to less frequently used commands. In this case, it assigns the shortcut Ctrl+R to the Reply button and Ctrl+Shift+R to the Reply All button, Ctrl+J to the Forward button and Ctrl+Shift+J to the Forward As Attachment button, and so forth.

    * Recommendation: Facilities to establish and adjust keybindings should allow content, add-ins, and the user to bind commands to specific key combinations, rather than merely specifying a single base character. HTML would let the author specify preferred keyboard inputs for accesskey and the like including recommended base keys and modifiers (e.g. accesskey="ctrl+shift+i", using standardized, non-locale-specific names for keys and modifier keys). There should also be way for the author to request that a key be unmodified, as discussed in the section "Allowing unmodified keys as shortcuts". These recommended keyboard inputs would be modified by the browser to accommodate impossible, reserved, restricted, or conflicting inputs (as discussed in bug 13564 Negotiating shortcut keybindings). For example, when an HTML5 command element is used to create a menu item and the user agent wants to emulate native access key behavior on the Windows platform, it would limit the access key to a single character that could be used alone or with the Alt key depending on the situation, but when a command element is used to establish a hotkey for a scripted action the user agent could allow a wider range of modifiers and/or sequences.
Comment 1 Michael[tm] Smith 2011-08-04 05:01:45 UTC
mass-moved component to LC1
Comment 2 Ian 'Hixie' Hickson 2011-08-09 23:52:56 UTC
The plan is to do this in v2, once we've proved that the stuff in the spec already actually works. The idea is we'll define key labels to use in the attribute, as in accesskey="up". For sequences we might do something like "accesskey="x-s". To enable this future expansion, the spec currently limits values to one character.

I'm marking this LATER for now but will reopen this once browsers have more widely adopted what we have in the spec so far.
Comment 3 public-rdfa-wg 2013-01-24 06:54:58 UTC
This bug was cloned to create HTML WG bug 19044.
Comment 4 Ian 'Hixie' Hickson 2013-03-18 22:30:05 UTC
Are there browsers who have implemented the current accesskey="" feature as per the spec, and who are interested in doing this?
Comment 5 Domenic Denicola 2019-03-29 19:24:01 UTC
W3C Bugzilla is closing down, and as such we're closing all feature request bugs against HTML as "WONTFIX", at least wontfix-in-this-bugtracker. (We have been told the Bugzilla URLs will remain active, but read-only.)

If you still think this feature is valuable, please feel free to open a new issue against ; the community has gotten much more active and involved since the Bugzilla days, and you might get a more useful dialogue there.