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

瀏覽器相容性

另見