HTMLElement: accessKeyLabel property

Limited availability

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.

Example

JavaScript

js
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);
};

HTML

html
<button accesskey="h" title="Caption" id="btn1">Hover me</button>

Result

Specifications

Specification
HTML
# dom-accesskeylabel

Browser compatibility

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
Chrome – No support
Chrome
footnote
footnote See bug 41119923
Edge – No support
Edge
footnote
footnote See bug 41119923
Firefox – Full support
Firefox 8 (Release date: 2011-11-08)
footnote Full support
Opera – No support
Opera
footnote
footnote See bug 41119923
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Chrome Android – No support
Chrome Android
footnote
footnote See bug 41119923
Firefox for Android – Full support
Firefox for Android 8 (Release date: 2011-11-08)
footnote Full support
Opera Android – No support
Opera Android
footnote
footnote See bug 41119923
Safari on iOS – Full support
Safari on iOS 14 (Release date: 2020-09-16)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote
footnote See bug 41119923
WebView Android – No support
WebView Android
footnote
footnote See bug 41119923
WebView on iOS – Full support
WebView on iOS 14 (Release date: 2020-09-16)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

See also