ElementInternals: ariaBrailleRoleDescription 属性
ElementInternals 接口的 ariaBrailleRoleDescription 属性反映了 aria-brailleroledescription 属性的值,该属性定义了元素的 ARIA 盲文角色描述。
此属性可用于提供 aria-roledescription 值的缩写版本。仅当存在 aria-roledescription 且在极少数情况下其对盲文来说过于冗长时才应使用此属性。 aria-brailleroledescription 包含有关何时应设置此属性的更多信息。
值
一个打算转换为盲文的字符串。
示例
假设我们有一个自定义的幻灯片元素
js
class CustomSlide extends HTMLElement {
constructor() {
super();
this._internals = this.attachInternals();
this._internals.role = "slide";
}
// …
}
customElements.define("custom-slide", CustomSlide);
我们可以检索和设置自定义元素的 aria-brailleroledescription 值
js
const customEl = document.querySelector("custom-slide");
log(customEl.ariaBrailleRoleDescription);
customEl.ariaBrailleRoleDescription = "sd";
log(customEl.ariaBrailleRoleDescription);
结果
规范
| 规范 |
|---|
| 无障碍富互联网应用程序 (WAI-ARIA) # dom-ariamixin-ariabrailleroledescription |
浏览器兼容性
加载中…