NarfkX
NarfkX

Reputation: 6126

Should an Accesskey attribute be unique

Our CMS manufacturer delivers HTML templates that look like this:

<li><a accesskey="A" href="#">Accordion</a></li>
<li><a accesskey="A" href="#">Audio/Video</a></li>
<li><a accesskey="C" href="#">Charts</a></li>
<li><a accesskey="C" href="#">Container</a></li>
<li><a accesskey="F" href="#">Forms</a></li>

In my opinion, the attributes have to be unique. Is this correct?

Upvotes: 2

Views: 531

Answers (2)

Quentin
Quentin

Reputation: 943999

HTML provides no guidance on the subject.

A WCAG note says offers this as a failure state for one of its tests:

An accesskey attribute value that is not unique

In practical terms, some browsers will allow the elements to be cycled through, while others will take only one value as acceptable.


TLDR: There's no requirement that they be unique, but duplicates will cause issues.

Upvotes: 1

Victor Leontyev
Victor Leontyev

Reputation: 8736

It is not required. The behaviour if more than one element has the same accesskey different in different browsers:

  • IE, Firefox: The next element with the pressed accesskey will be activated
  • Chrome, Safari: The last element with the pressed accesskey will be activated
  • Opera: The first element with the pressed accesskey will be activated

Upvotes: 3

Related Questions