JavaScript Element ariaKeyShortcuts Property

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline
Instance property

What You’ll Learn

Element.ariaKeyShortcuts is an instance property that reflects the aria-keyshortcuts attribute. Learn how to document keyboard shortcuts that activate or focus an element, how to get or set the string from JavaScript, and why you must still implement the real key handlers—with five examples and try-it labs.

01

Kind

Instance property

02

Type

String

03

Example

Alt+Shift+A

04

Reflects

aria-keyshortcuts

05

Status

Baseline widely

06

Does not

Create key handlers

Introduction

Many apps offer keyboard shortcuts: skip to content, save a form, open a menu. Sighted users may see a tooltip; assistive technology users need the same information in the accessibility tree.

aria-keyshortcuts documents those shortcuts. ariaKeyShortcuts is the JavaScript reflection of that attribute.

JavaScript
const el = document.getElementById("skip-link");
console.log(el.ariaKeyShortcuts); // "Alt+Shift+A"
el.ariaKeyShortcuts = "Alt+Shift+M";
💡
Beginner tip

This property describes shortcuts you implement. It does not register keydown listeners. Always keep the string in sync with the real handler, and avoid conflicting with browser or OS shortcuts when you can.

Understanding the Property

MDN: the ariaKeyShortcuts property of the Element interface reflects the value of the aria-keyshortcuts attribute, which indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.

  • Reflected attribute — mirrors aria-keyshortcuts.
  • Get / set — readable and writable string.
  • Author-implemented — documents shortcuts you already built.
  • Baseline — widely available since October 2023 (MDN).

📝 Syntax

JavaScript
ariaKeyShortcuts

Value

A string describing the keyboard shortcut(s), for example:

Example stringMeaning
"Alt+Shift+A"Alt, Shift, and A together
"Control+S"Control and S (often “save”)
"Alt+Shift+A Alt+Shift+M"Multiple shortcuts, space-separated
⚠️
Implementation warning

Setting ariaKeyShortcuts alone never activates the control. You must listen for the matching keys and call click(), move focus, or run your action yourself.

📋 MDN Example Shape

MDN starts with aria-keyshortcuts="Alt+Shift+A" on a skip link, then updates it to "Alt+Shift+M" with the property (IDs aligned for this tutorial):

JavaScript
<a id="skip-link" href="#content" aria-keyshortcuts="Alt+Shift+A">
  Skip to content
</a>
JavaScript
let el = document.getElementById("skip-link");
console.log(el.ariaKeyShortcuts); // "Alt+Shift+A"
el.ariaKeyShortcuts = "Alt+Shift+M";
console.log(el.ariaKeyShortcuts); // "Alt+Shift+M"

⚡ Quick Reference

GoalCode / note
Readel.ariaKeyShortcuts
Document shortcutel.ariaKeyShortcuts = "Alt+Shift+A"
Update stringel.ariaKeyShortcuts = "Alt+Shift+M"
Make it workAdd your own keydown handler
Multiple shortcutsSpace-separate in the string
MDN statusBaseline Widely available

🔍 At a Glance

Four facts about Element.ariaKeyShortcuts.

Kind
get / set

Instance

Type
string

Shortcut text

Reflects
aria-keyshortcuts

Attribute

Baseline
widely

Oct 2023+

Examples Gallery

Examples follow MDN Element: ariaKeyShortcuts. Labs use a skip-link style control so you can safely read and write the property.

📚 Getting Started

Read the reflected value and follow MDN’s update.

Example 1 — Read ariaKeyShortcuts

Log the documented shortcut from a skip link.

JavaScript
const el = document.getElementById("skip-link");
console.log(el.ariaKeyShortcuts);

// HTML includes: aria-keyshortcuts="Alt+Shift+A"
Try It Yourself

How It Works

The property returns the attribute string. If the attribute is missing, many browsers return null.

Example 2 — MDN Update to "Alt+Shift+M"

MDN: change the documented shortcut string on the element.

JavaScript
let el = document.getElementById("skip-link");
console.log(el.ariaKeyShortcuts); // "Alt+Shift+A"
el.ariaKeyShortcuts = "Alt+Shift+M";
console.log(el.ariaKeyShortcuts); // "Alt+Shift+M"
Try It Yourself

How It Works

Assigning the property updates the reflected aria-keyshortcuts attribute so assistive technologies can announce the new shortcut documentation.

📈 Button Shortcut, Attribute Sync & Snapshot

Practice documenting actions and verify reflection.

Example 3 — Document a Save Shortcut

Create a button and set ariaKeyShortcuts to Control+S.

JavaScript
const btn = document.createElement("button");
btn.textContent = "Save changes";
document.body.appendChild(btn);

btn.ariaKeyShortcuts = "Control+S";
console.log({
  ariaKeyShortcuts: btn.ariaKeyShortcuts,
  attr: btn.getAttribute("aria-keyshortcuts")
});
Try It Yourself

How It Works

After documenting the shortcut, add a matching keydown listener that actually saves—or the string will mislead users.

Example 4 — Property vs getAttribute

Confirm the attribute stays in sync after a write.

JavaScript
const el = document.createElement("a");
el.href = "#content";
el.textContent = "Skip to content";
el.setAttribute("aria-keyshortcuts", "Alt+Shift+A");
document.body.appendChild(el);

el.ariaKeyShortcuts = "Alt+Shift+M";
console.log({
  fromProperty: el.ariaKeyShortcuts,
  fromAttribute: el.getAttribute("aria-keyshortcuts"),
  same: el.ariaKeyShortcuts === el.getAttribute("aria-keyshortcuts")
});
Try It Yourself

How It Works

Prefer ariaKeyShortcuts in script; keep the attribute for HTML markup.

Example 5 — Support Snapshot

Feature-detect and remember the author-implement rule.

JavaScript
console.log({
  supported: "ariaKeyShortcuts" in Element.prototype,
  type: "string",
  tip: "Documents shortcuts you implement — does not create handlers",
  status: "Baseline Widely available (MDN)"
});
Try It Yourself

How It Works

Use the property as documentation for AT, and keep your real keyboard logic as the source of truth.

🚀 Common Use Cases

  • Skip links with documented focus shortcuts.
  • Toolbar buttons that also respond to accelerator keys.
  • Custom widgets that activate on a known key combination.
  • Updating documented shortcuts when the app locale or keymap changes.
  • Keeping script and markup aligned without manual setAttribute.

🔧 How It Works

1

You implement a keyboard shortcut

Listen for keys and activate or focus the control.

Behavior
2

Set ariaKeyShortcuts to match

Document the same combination as a string for AT.

Document
3

Assistive tech can announce it

Users discover the shortcut from the accessibility tree.

Announce
4

Docs and behavior stay aligned

Update both when the shortcut changes.

📝 Notes

  • Not Deprecated, Experimental, or Non-standard on MDN (Baseline Widely available).
  • Does not create keyboard handlers—only documents them.
  • Prefer non-conflicting shortcuts when possible (avoid stealing browser defaults).
  • Related: ariaLabel, ariaHasPopup, EventTarget, JavaScript hub.

Browser Support

Element.ariaKeyShortcuts is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.

Baseline Widely available

Element.ariaKeyShortcuts

String — reflects aria-keyshortcuts for author-implemented keyboard shortcuts.

Baseline Widely available
Google Chrome Supported (ARIA reflection)
Yes
Microsoft Edge Supported (ARIA reflection)
Yes
Mozilla Firefox Supported (ARIA reflection)
Yes
Apple Safari Supported (ARIA reflection)
Yes
Opera Follow Chromium support
Yes
Internet Explorer No ariaKeyShortcuts IDL — use setAttribute
No
ariaKeyShortcuts Baseline

Bottom line: Use ariaKeyShortcuts to document shortcuts you implement. Keep the string in sync with real keydown handlers. The property alone never activates the control.

Conclusion

ariaKeyShortcuts reflects aria-keyshortcuts so you can document author-implemented keyboard shortcuts for assistive technologies. Pair the string with real key handling, and update both whenever the shortcut changes.

Continue with ariaLabel, ariaHasPopup, EventTarget, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Document only shortcuts you actually implement
  • Keep the string matching your keydown logic
  • Use clear modifier+key naming (for example Alt+Shift+A)
  • Expose a visible hint when it helps sighted users too
  • Test with keyboard and assistive technology

❌ Don’t

  • Assume the attribute creates shortcut behavior
  • Document shortcuts that do nothing
  • Blindly override essential browser shortcuts
  • Leave stale strings after changing keymaps
  • Skip an accessible name on the control itself

Key Takeaways

Knowledge Unlocked

Five things to remember about ariaKeyShortcuts

Reflected aria-keyshortcuts string for documented keyboard shortcuts.

5
Core concepts
📝 02

String value

e.g. Alt+Shift+A

Type
🔍 03

Documents only

you implement handlers

Rule
04

Baseline

widely available

Status
🎯 05

Stay in sync

string + keydown

Pair

❓ Frequently Asked Questions

It reflects the aria-keyshortcuts attribute as a string, indicating keyboard shortcuts that an author has implemented to activate or give focus to an element.
No. MDN marks Element.ariaKeyShortcuts as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
A string describing the shortcut(s), for example "Alt+Shift+A" or "Control+S". Multiple shortcuts can be space-separated in the attribute.
No. The property only documents shortcuts you already implement. You still need keydown (or similar) listeners that actually activate or focus the element.
Follow ARIA key shortcut naming (modifier keys plus a key, joined with +). Keep the documented string in sync with the real handler.
Yes. Reading and writing ariaKeyShortcuts updates the reflected aria-keyshortcuts attribute.
Did you know?

ARIA allows space-separated lists in aria-keyshortcuts, so one control can advertise more than one combination. Still implement every shortcut you list—or remove the ones you do not support.

Next: Element ariaLabel

Learn the reflected aria-label property for accessible names.

ariaLabel →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful