Back to article index

Keybindings in Web Browsers

2007-07-23 (updated 2007-08-10)Marc Englund


Keybindings, or keyboard shortcuts, undoubtedly increase usability, accessibility, and speed for the seasoned user - yet they are very seldom seen on the web. There are several reasons for this, some of which are outlined below.

 

UPDATE 2007-08-10:

Some specs: in the test, we listen for the "keydown" -event, read the keycode + modifiers, and try to cancel the event (to prevent the browser default). We also cancel "keyup" and "keypress" - this will prevent more side effects in some browsers. The canceling code is as follows:

        function cancelEvent(e) { 
            // try to prevent side effects (browser defaults)
            e = e || window.event;
            e.cancelBubble = true;
            e.returnValue = false;
            if (e.stopPropagation) e.stopPropagation();
            if (e.preventDefault) e.preventDefault();   
            return false;
        }

Here is the full html test page if you want to try it out yourself.

UPDATE 2007-07-28:

For the impatient readers out there: Here are the full test results for IE, FF and Opera on Windows. You'll find the compiled version of these tests below.

Modern browsers do provide built-in ways to navigate web-pages with the keyboard, but usually you have to use multiple keystrokes to get to a link or button, before you can 'click' it - and although some browsers actually assign keybindings automatically, the browser simply can not know what would be a good keybinding for a specific function. And even worse: if the page changes, the keybindings might change - and they probably will.

This is of course unacceptable for web applications - imagine a secretary using a word-processor with keybindings that might change depending on the content of the document...

The problem with keybindings on the web is mostly a multiple platform problem; your users might be using one of several operation systems, with different utility-applications installed, running various browsers, and using different keyboard layouts.
Some things to consider:

  • The operating system capture some key-combinations before they even reach the browser. Which key-combinations depends on the operating system - like Ctrl-Alt-Delete on windows.
  • Many utility-applications also capture key-combinations; for instance my Lenovo pops up a password manager when I press Ctrl-F2, and Ctrl-Alt-F12 opens the Intel Graphics Media driver configuration window. 
  • The browser has built in keybindings. Some browsers allow many to be overridden, other browsers do not - and the keybindings vary between browsers. Some of the built-in keybindings still come trough so that your application can react, but they also cause some side-effect, like opening a new browser window. 
  • Some keys vary between operating systems (and hardware platforms), especially 'meta' or control keys; windows uses Ctrl, where mac uses Command (although mac keyboards do have a Ctrl -key as well), and the recommended keybindings for common actions might vary. 
  • US keyboard layouts differ from Finnish, which differ from French (for instance) - some keybindings might be awkward or impossible for someone using a different layout. Semi-colon (;) was bound to zoom-out in one application - but I have to press Shift to get that character, and the application did not expect shift to be pressed, so I could not zoom out using the keyboard. Much in the same way, many users might find Ctrl-Å difficult... Another example: forward-slash is convenient on US keyboards, but requires Shift-7 on Finnish keyboards.

Keybinding compatiblity chart for typical Windows browsers 

Keybinding support for the most common Windows-based web browsers is summarized in the following table. Tested browsers were Firefox 2, Internet Explorer 7 and Opera 9.
   
Keyboard modifiers and color codes:
             
A=Alt, C=Ctrl, S=Shift, CA=Ctrl+Alt, CS=Ctrl-Shift, AS=Alt+Shift  
Supported          
Not Supported          
Causes side-effect / Uncertain          
               
               
 Summary of the all tested browsers
Function keys
A S C CA CS AS
F1 P P P P P P Y
F2 P P P P P P Y
F3 P P P P P P Y
F4 P P P P P P P
F5 P P P P P Y Y
F6 Y P P Y P Y P
F7 P P Y Y P Y Y
F8 P P P P P Y Y
F9 Y P Y Y P Y Y
F10 P P Y Y P Y Y
F11 P P P Y P Y Y
F12 P P P P P P P
               
Special keys
A S C CA CS AS
Esc Y P P P P P P
Insert Y P Y Y Y Y Y
Delete Y P Y Y P Y Y
Home Y P Y Y Y Y Y
End Y P Y Y Y Y Y
Pgup Y P Y Y Y Y Y
Pgdn Y P Y Y Y Y Y
Prnscr N N N N N N P
Pause Y P Y P P P Y
Up Y P Y Y P Y Y
Dn Y P Y Y P Y Y
Left Y P Y Y P Y Y
Right Y P Y Y P Y Y
Win P P Y Y Y Y Y
Menu P P P P P P P
               
Alphanumeric
A S C CA CS AS
1 Y P Y P Y P Y
2 Y P Y P Y P Y
3 Y P Y P Y Y Y
4 Y P Y Y Y P Y
5 Y P Y Y Y Y Y
6 Y P Y P Y P Y
7 Y P Y P P P Y
8 Y P Y P Y P Y
9 Y P Y P Y P Y
0 Y P Y P Y P Y
A Y P Y Y Y Y Y
B Y P Y Y P P Y
C Y P Y Y Y Y Y
D Y P Y P Y P P
E Y P Y P P Y Y
F Y P Y P Y Y Y
G Y P Y P Y P Y
H Y P Y P P P Y
I Y P Y P Y Y Y
J Y P Y P P P Y
K Y P Y P Y P Y
L Y P Y P P P Y
M Y P Y P Y Y Y
N Y P Y P P P Y
O Y P Y P P Y Y
P Y P Y P Y Y Y
Q Y P Y P Y Y Y
R Y P Y P P P Y
S Y P Y P P Y Y
T Y P Y P P Y Y
U Y P Y Y Y Y Y
V Y P Y Y P Y Y
W Y P Y P P P Y
X Y P Y Y Y Y Y
Y Y P Y Y Y Y Y
Z Y P Y Y P Y Y

>> Click here for full compatibility table

 







Back to article index


Add Your Comment

Comments, corrections and suggestions about the content of this article are always welcome.