ElementInternals:ariaSort 屬性

Baseline 2023
新推出

自 ⁨2023 年 10 月⁩ 以來,此功能已在最新裝置和瀏覽器版本中得到支援。此功能可能無法在舊裝置或瀏覽器上執行。

ElementInternals 介面的 ariaSort 屬性反映了 aria-sort 屬性的值,該屬性指示表或網格中的專案是否按升序或降序排序。

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

一個字串,其值可能為以下之一:

“ascending”(升序)

此列按升序排序。

“descending”(降序)

此列按降序排序。

"none"

該列未應用已定義的排序。

"other"

已應用除升序或降序以外的排序演算法。

示例

在此示例中,ariaSort 的值設定為“ascending”(升序)。

js
class CustomControl extends HTMLElement {
  constructor() {
    super();
    this.internals_ = this.attachInternals();
    this.internals_.ariaSort = "ascending";
  }
  // …
}

規範

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

瀏覽器相容性

另見