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 |
浏览器兼容性
加载中…