Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML attribute accesskey not working as it should

So, I'm testing all different HTML tags and attributes, freshing things up a bit, and for some reason, accesskey does not appear to be working.

The accesskey attribute is used to assign a key to an element. Depending on your OS, pressing Alt+that key (Windows) or Cmd+that key (Mac) will give focus to that element.

Here's a little something:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
        a:focus{
            color:red
        }
    </style>
</head>
<body>
    <a accesskey="x" target="new" href="#">Hello</a>
</body>
</html>

So I'm working on a Windows machine. Thusly, I expect the anchor to go red when I press Alt+x. Yet it is not. Is there something wrong with the code, or am I expecting the wrong thing to happen?

On Firefox, nothing happens. Google chrome opens a new tab (as it should, the target attribute say "new", which means open in new tab/window) and IE jumps to the anchor but does nothing further.

like image 347
Vordreller Avatar asked Feb 05 '09 13:02

Vordreller


1 Answers

Firefox's accesskey modifier is Shift+Alt.

like image 109
bobince Avatar answered Nov 11 '22 00:11

bobince