Element: ariaRoleDescription 属性

Baseline 2023
新推出

自 ⁨2023 年 10 月⁩ 以来,此功能已在最新设备和浏览器版本中得到支持。此功能可能无法在旧设备或浏览器上运行。

Element 接口的 ariaRoleDescription 属性反映了 aria-roledescription 属性的值,该属性为元素的角色定义了一个人类可读的、作者本地化的描述。

字符串。

示例

在此示例中,ID 为 myApplication 的元素的 aria-roledescription 属性已设置。使用 ariaRoleDescription 我们可以更新该值。

html
<div
  id="myApplication"
  role="application"
  aria-roledescription="a description of this widget">
  …
</div>
js
let el = document.getElementById("myApplication");
console.log(el.ariaRoleDescription); // "a description of this widget"
el.ariaRoleDescription = "an updated description of this widget";
console.log(el.ariaRoleDescription); // "an updated description of this widget"

规范

规范
无障碍富互联网应用程序 (WAI-ARIA)
# dom-ariamixin-ariaorientation

浏览器兼容性

另见