aria-colindextext
aria-colindextext 屬性定義了數字 aria-colindex 的人類可讀文字替代項。
描述
當您有一個非常大的表格或當您有意僅顯示錶格的一部分時,並非所有列都可能存在於 DOM 中。發生這種情況時,我們使用 aria-colcount 和整數來定義如果所有列都存在表格(或網格)將有多少列,並在每一列上新增 aria-colindex 屬性以提供有關該更大表格中列索引的資訊。
在以下 HTML 程式碼段中,我們的表格有 8 列,但我們只顯示了 4 列。“城市”列是我們更大表格的第五列,如 aria-colindex="5" 所定義。
<table aria-colcount="8">
<thead>
<tr>
<th aria-colindex="1" scope="col">First name</th>
<th aria-colindex="2" scope="col">Last name</th>
<th aria-colindex="5" scope="col">City</th>
<th aria-colindex="7" scope="col">Zip</th>
</tr>
</thead>
…
</table>
此表格並不複雜。如果這是一個包含 100 多列的電子表格或沒有列標題的網格(例如棋盤),則 aria-colindex 的提供或計算值可能沒有意義或可能不反映顯示的索引。在這種情況下,可以包含 aria-colindextext。該值是一個字串,它是數字 aria-colindex 的人類可讀文字替代項。
<table aria-colcount="128">
<thead>
<tr>
<th aria-colindex="1" aria-colindextext="NYSE stock symbol" scope="col">
NYSE
</th>
<th
aria-colindex="110"
aria-colindextext="Value at start of 2021"
scope="col">
01/21
</th>
<th
aria-colindex="122"
aria-colindextext="Value at start of 2022"
scope="col">
01/22
</th>
<th aria-colindex="124" scope="col">Recommendation</th>
</tr>
</thead>
…
</table>
在上面的示例中,表格有 128 列,但僅顯示了 4 列。aria-colindextext 用於三列以提供人類可讀的文字替代項。透過包含 aria-colindextext="2021 年初的值",輔助技術可以宣佈“2021 年初的值”而不是“第 110 列”。
僅當 aria-colindex 的提供或計算值沒有意義或不反映顯示的索引時,才使用 aria-colindextext。每當您包含 aria-colindextext 時,也請保留 aria-colindex,因為某些輔助技術依賴於數字列索引以跟蹤使用者的位置並提供替代表格導航。
注意:雖然當所有存在的列都是連續的時,可以將 aria-colindex 新增到行中,因為可以推匯出順序值,但 aria-colindextext **不是** row 的受支援屬性。
請參閱相關的 aria-rowindextext。
值
<字串>-
數字
aria-colindex的人類可讀文字替代項
關聯介面
Element.ariaColIndexText-
ariaColIndexText屬性(Element介面的一部分)反映了aria-colindextext屬性的值。 ElementInternals.ariaColIndexText-
ariaColIndexText屬性(ElementInternals介面的一部分)反映了aria-colindextext屬性的值。
關聯角色
規範
| 規範 |
|---|
| 可訪問的富網際網路應用程式 (WAI-ARIA) # aria-colindextext |