ElementInternals: ariaRoleDescription 屬性
ElementInternals 介面的 ariaRoleDescription 屬性反映了 aria-roledescription 屬性的值,該屬性定義了元素的角色的一個可讀的、由作者本地化的描述。
注意:在 ElementInternals 上設定 ARIA 屬性允許為自定義元素定義預設語義。這些預設語義可能會被作者定義的屬性覆蓋,但可以確保在作者刪除或根本未新增這些屬性時,預設語義仍然保留。有關更多資訊,請參閱 Accessibility Object Model explainer。
值
字串。
示例
在此示例中,ariaRoleDescription 的值被設定為“My custom widget”。
js
class CustomEl extends HTMLElement {
constructor() {
super();
this.internals_ = this.attachInternals();
this.internals_.ariaRoleDescription = "My custom widget";
}
// …
}
規範
| 規範 |
|---|
| 無障礙富網際網路應用程式 (WAI-ARIA) # dom-ariamixin-ariaroledescription |
瀏覽器相容性
載入中…