Element: ariaDescription 属性

Baseline 2024
新推出

自 ⁨2024 年 3 月⁩ 起,此功能可在最新的设备和浏览器版本上运行。此功能可能不适用于较旧的设备或浏览器。

Element 接口的 ariaDescription 属性反映了 aria-description 属性的值,该属性定义了一个描述或注解当前元素的字符串值。

字符串。

示例

在此示例中,ID 为 close-button 的元素的 aria-description 属性设置为字符串“A longer description of the function of this element”。使用 ariaDescription,我们可以更新该值。

html
<button
  aria-label="Close"
  aria-description="A longer description of the function of this element"
  id="close-button">
  X
</button>
js
let el = document.getElementById("close-button");
console.log(el.ariaDescription); // "A longer description of the function of this element"
el.ariaDescription = "A different description";
console.log(el.ariaDescription); // "A different description"

规范

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

浏览器兼容性