Reputation: 2530
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.
Upvotes: 6
Views: 9658
Reputation: 536567
According to Mozilla's documentation on accesskey
Firefox's accesskey for Windows and Linux modifier is Shift+Alt.
Upvotes: 17
Reputation: 1336
Alt + [the accesskey]
Internet Explorer for Windows
Chrome for Windows (not that Shift is required in some circumstances
Safari for Windows
Shift + Alt + [the accesskey]
Firefox for Windows
Ctrl + Option + [the accesskey]
Safari for Mac
Chrome for Mac
Firefox for Mac
Upvotes: 6
Reputation: 1949
If you are using firefox on mac then, you should press ctrl + 'your access key'.
Upvotes: -1
Reputation:
If you're determined to assign accesskeys (and there may be some good reasons to use this terribly implemented feature), you should take a look at WebAIM's page on accesskeys which outlines some of the obstacles you'll face.
One thing, on the Mac most browsers that support accesskeys --except Opera-- use Control not Command. Opera apparently uses Shift-Esc ... who knew?
Upvotes: 4
Reputation: 39893
In firefox you need to press shift+alt. In IE hitting the modifyer key only sets focus to that element, this is by design. These are the only two browsers accessible with my screen reader so can't give you more info on others.
Upvotes: 0
Reputation: 115372
You have to press Enter to follow the link when it has the focus in IE.
Upvotes: 3