If your website has custom keyboard shortcuts, you need to tell your users.
WAI-ARIA (Web Accessibility Initiative - Accessible Rich Internet Applications) can greatly improve accessibility, particularly if you’re developing a web application with desktop-like functionality.
As we’ve discussed in other articles, it’s crucial to remember the first rule of ARIA: Wherever possible, use semantic HTML instead — avoid using ARIA unless you absolutely need it.
There’s one potential exception: In complex web-based applications, the aria-keyshortcuts attribute may be preferable to the HTML accesskey attribute. Here’s why, along with some tips for using the attribute appropriately.
Crucially, aria-keyshortcuts enables authors to identify site-specific keyboard shortcuts to assistive technologies (AT). However, unlike the HTML accesskey attribute, aria-keyshortcuts attribute does not modify the functionality of your page.
Its purpose is simply to identify the existence of keyboard shortcuts for AT users. This makes aria-keyshortcuts more robust than accesskey because it can work more effectively with different browsers and technologies.
While the HTML accesskey attribute was developed with good intentions, it has significant issues:
aria-keyshortcuts is less powerful, and generally, it’s a better option when web content absolutely must have unique keyboard shortcuts.
If you’re thinking about using aria-keyshortcuts, review the best practices from the Mozilla Developer Network, then follow these tips to avoid common mistakes.
You shouldn’t take control away from keyboard users. If your content uses shortcuts that are already well-established, you might be introducing an accessibility issue.
For example, Ctrl + C is widely used to copy text, images, or other content. Your web application shouldn’t change this functionality; keyboard users will expect to be able to use Ctrl + C for its usual purpose.
Best practices to keep in mind:
Related: 5 Tips for Using ARIA to Improve Web Accessibility
Screen readers will usually announce aria-keyshortcuts, but it’s important to remember that web accessibility isn’t just for people with visual disabilities. Many keyboard users can perceive content visually, and if a website relies solely on the aria-keyshortcuts attribute, those users may have trouble operating the content.
If your site uses unique keyboard shortcuts, you should present that information visually. If possible, write the keyboard instructions directly on the page). If that’s not an option, consider using tooltips or simple CSS (Cascading Style Sheets).
Related: How CSS Benefits Accessibility
People expect websites to work the same way, regardless of the technologies they use to browse the internet. While keyboard shortcuts may be helpful in specific circumstances, they can override user preferences — which makes for a poor user experience.
If you’re using aria-keyshortcuts or any other ARIA markup, we strongly recommend working with an accessibility partner. Testing your content regularly will help you avoid common implementation mistakes, which can help you reach a wider audience.
To learn more best practices, read our Introduction to ARIA for Web Accessibility. If you have specific questions about ARIA, send us a message to connect with an expert.