ElementInternals: ariaBrailleRoleDescription 屬性

Baseline 2024
新推出

自 2024 年 9 月起,此功能已可在最新裝置和瀏覽器版本上使用。此功能可能無法在舊裝置或瀏覽器上使用。

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

瀏覽器相容性

另見