This feature is not Baseline because it does not work in some of the most widely-used browsers.
The HTMLElement.accessKeyLabel read-only property returns a string containing the element's browser-assigned access key (if any); otherwise it returns an empty string.
const btn = document.getElementById("btn1");
const shortcutLabel = btn.accessKeyLabel || btn.accessKey;
btn.title += ` [${shortcutLabel.toUpperCase()}]`;
btn.onclick = () => {
const feedback = document.createElement("output");
feedback.textContent = "Pressed!";
btn.insertAdjacentElement("afterend", feedback);
};
<button accesskey="h" title="Caption" id="btn1">Hover me</button>
| Specification |
|---|
| HTML> # dom-accesskeylabel> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
accessKeyLabel |
No | No | 8 | No | 14 | No | 8 | No | 14 | No | No | 14 |
HTMLElement.accessKey
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/accessKeyLabel