ElementInternals: ariaDescription 屬性

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

ElementInternals 介面的 ariaDescription 屬性反映了 aria-description 屬性的值,該屬性定義了一個描述或註解當前元素的字串值。

注意:ElementInternals 上設定 ARIA 屬性允許為自定義元素定義預設語義。這些預設語義可能會被作者定義的屬性覆蓋,但可以確保在作者刪除或根本未新增這些屬性時,預設語義仍然保留。有關更多資訊,請參閱 Accessibility Object Model explainer

字串。

示例

在此示例中,ariaDescription 的值為 "A description of this widget"。

js
class CustomControl extends HTMLElement {
  constructor() {
    super();
    this.internals_ = this.attachInternals();
    this.internals_.ariaDescription = "A description of this widget";
  }
  // …
}

規範

規範
無障礙富網際網路應用程式 (WAI-ARIA)
# dom-ariamixin-ariadescription

瀏覽器相容性