In the world of web accessibility, the accesskey attribute was intended to be a helpful tool for users who rely on keyboards for navigation. It allows you to assign a keyboard shortcut to an element, making it easier for users to activate it. However, this attribute is now widely considered a legacy feature and an accessibility anti-pattern. If you must use it, it is absolutely critical that every `accesskey` value on a page is unique, otherwise you can create a confusing and frustrating experience for your users.
Think of your accesskey values as the keys on a piano. Each key should produce a unique sound. If you have two keys that produce the same sound, it’s going to be difficult to play a melody. The same is true for your website. By giving each element a unique accesskey value, you can avoid ambiguity. For a deeper dive into the world of accessibility, see our article on accessibility.

The Problems with the `accesskey` Attribute
Before fixing duplicate values, it’s important to understand why modern accessibility guidance recommends against using the `accesskey` attribute at all. As explained in the MDN Web Docs, the attribute has several major flaws:
- It creates conflicts: An `accesskey` can easily conflict with shortcuts used by the operating system, the browser, or assistive technologies like screen readers. This can have unpredictable and disruptive results.
- It is not discoverable: There is no standard way for users to know that you have assigned an accesskey to an element, which often leads to them being triggered by accident.
- It is inconsistent: The modifier keys used to activate an accesskey (e.g., Alt, Ctrl, Shift) vary across different browsers and operating systems.
How to Fix Accesskey Issues
Given the problems, the best practice is often to remove the attribute entirely. Here is a prioritized approach to fixing this issue:
- Identify All `accesskey` Attributes: Use an accessibility testing tool like Creeper to crawl your site and identify every element that uses the `accesskey` attribute.
- Consider Removing Them: The best and safest solution is to remove the `accesskey` attribute altogether. Standard keyboard navigation using the `Tab` key is a much more predictable and accessible experience for all users.
- If You Must Use Them, Ensure They Are Unique: If, for a specific reason, you must keep the attribute, ensure that every single value is unique on a given page. Go through your code and change any duplicate values to a new, unique character.
For more on the importance of a well-structured website, check out this guide to accessibility from the W3C.

Frequently Asked Questions
What is the accesskey attribute?
The accesskey attribute is a global HTML attribute that provides a hint for generating a keyboard shortcut for the current element. The idea is to allow users to activate or focus on an element using the keyboard.
Should I use the accesskey attribute?
Generally, no. Modern accessibility guidance strongly advises against using the `accesskey` attribute because it can easily conflict with browser, operating system, and screen reader shortcuts, creating a frustrating and unpredictable user experience. It is better to rely on standard keyboard navigation (like the Tab key).
If I must use it, why is it important to have unique accesskey values?
If you have two elements with the same accesskey value, the browser may not know which one to activate when the user presses the corresponding key combination. This creates an ambiguous and confusing experience. Therefore, if you absolutely must use this attribute, every value on a given page must be unique.
Ready to unlock the power of accessibility? Start your Creeper audit today and see how you can improve your website’s accessibility.