此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

Element:ariaKeyShortcuts 属性

Baseline 2023
Newly available

Since ⁨October 2023⁩, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Element 接口的 ariaKeyShortcuts 属性反射 aria-keyshortcuts 属性的值。该属性表示开发者为激活或聚焦某个元素而实现的键盘快捷键。

字符串。

示例

在本示例中,ID 为 skip-link 的元素上的 aria-keyshortcuts 属性被设置为“Alt+Shift+A”。通过使用 ariaKeyShortcuts,我们将该值更新为“Alt+Shift+M”。

html
<a id="skip-link" href="#content" aria-keyshortcuts="Alt+Shift+A">
  跳转到内容
</a>
js
let el = document.getElementById("saveChanges");
console.log(el.ariaKeyShortcuts); // “Alt+Shift+A”
el.ariaKeyShortcuts = "Alt+Shift+M";
console.log(el.ariaKeyShortcuts); // “Alt+Shift+M”

规范

Specification
Accessible Rich Internet Applications (WAI-ARIA)
# dom-ariamixin-ariakeyshortcuts

浏览器兼容性