accesskey
A keyboard shortcut for an element.
Syntax
<button accesskey="s">Save</button>Examples
Press Alt + S (on Windows) or Ctrl + Option + S (on Mac):
<button accesskey="s" onclick="this.textContent = 'Saved!'">Save (<kbd>S</kbd>)</button>Notes
The key combination depends on the browser and the system, and the chosen key may clash with shortcuts of the browser or a screen reader. That is why the attribute is rarely used, and the key must always be shown in the interface.
See also
- tabindex — Controls whether an element can be reached with the Tab key.
- <kbd>, <samp>, <var> — Keyboard input (`<kbd>`), program output (`<samp>`) and a variable in a formula (`<var>`).
In the tutorial
- Accessibility — How to make a page usable for everyone — keyboard use, focus, labels and alt, aria-label, contrast and meaningful tags.