While working on improving accessibility features of an application I learned about an HTML feature that I was not aware of before: the
The attribute allows you to add keyboard shortcuts to an element.
In order to assign a keyboard shortcut you add the
accesskey attribute to an element and assign it a letter. For instance the letter “a”, like this:
<div accesskey="a"> ... </div>
This automatically binds a shortcut to the element that either focuses it or triggers a click event.
The actual shortcut varies between browsers and platforms but in general in modern browsers it is
a for Windows and Linux and
a on the Mac and
a on Windows and Linux on Firefox.
Top comments (0)