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

瀏覽器相容性