The aria-keyshortcuts property informs the screen reader user the shortcuts developer implemented to activate or focus an element on the web page or an application. Aria-keyshortcuts is an ARIA 1.1 property. Developers use the accesskey attribute to assign a shortcut for an element on the web page. It is a great idea to implement a shortcut key for few controls on applications and web pages. However content developers should carefully consider the shortcut key they are going to assign.
The same shortcut key or accesskey assigned for a function or command should be the same as the property of aria-keyshortcut too. Following are some common practices to consider while implementing aria-keyshortcuts property.
Considerations for aria-keyshortcuts property
- Provide one or more modifier keys. Eg: Alt, control, shift etc.
- Provide exactly one non-modifier key. Eg: a â€“ z, 0 â€“ 9, special characters such as escape, tab, f1 etc.
- The sequence must be one or more modifier keys followed by a non-modifier key. Eg: Alt + f is the right key not the F + alt.
- The value of keys must be what the user hits on the keyboard not the keys that are the result of. Eg: The command will be Shift + 5 not %.
- The upper case and lower case letters are consider same. Eg: letter x and X are same.
Additional considerations for assigning aria-keyshortcuts
- The value of aria-keyshortcut must not conflict with browser, assistive technology or operating system key commands.
- The functionality or the script for invoking or focusing the element should be taken care by the developer. Aria-keyshortcuts property just informs the screen reader users about the existance of the shortcut.
- Consider the device and keyboard the users might be using to invoke the functionality. Users may use keyboards of different languages.
- Shortcut keys should be made available to wider set of users. Aria-keyshortcuts property can only be made available to screen reader users. Using a tooltip or any other mechanisms the assigned shortcut key must be intimated to all other users.
- Ensure that aria-keyshortcuts property is not available for disabled elements.
The shortcut keys not only help screen reader users or keyboard only users but power users highly depend on shortcut keys to make the task faster.
Aria-keyshortcuts used in roles
Can be assigned to any element of the base markup.
Values of aria-keyshortcuts
A string value that defines the shortcut key.