【发布时间】:2016-10-07 16:49:42
【问题描述】:
我有一个表格,其中包含一个“全选”复选框作为标题行的第一列。
问题是列标题在表示其列的数据类型时非常有意义,但此 th 的内容只是一个带有“全选”标签的复选框。
现在,它设置了与其列中所有复选框的关系,我们基本上是说所有复选框都与“全选”相关。
有什么方法可以在表格标题中标记一个“全选”复选框,这样在标签方面的关系就会被它下面的所有复选框破坏?
我已经读过将包含“全选”复选框的表头中的 th 更改为 td 将解决此问题(确实如此),但很好奇是否有其他解决方案不需要我影响标头的标记。
对于复选框表格标题和表格单元格,屏幕阅读器读取如下:
这是管理课程表。 3行6列的表格 第 1 行 选择此表中的所有项目 第 1 列 选择此表中的所有项目 复选框未选中
row2 选择此表第 1 列中的所有项目 开发 ILT 1 复选框未选中
如您所见,将“Dev ILT 1”课程的选择复选框宣布为“选择此表中的所有项目”具有误导性
代码示例。这只是标题和正文部分。代码示例中并未列出所有行或标题,因为它不相关
<thead>
<tr class="thead-main">
<th align="center" scope="col" valign="top" class="colheadcheckbox">
<input type="checkbox" aria-label="Select all items in this table" onclick="SelectAllCheckbox.CheckUncheckAll(this, 'selectedID')" id="SelectAll">
<label for="SelectAll"><span class="hidden">Select all items in this table.</span></label>
</th>
<th scope="col" align="left" valign="middle" class="colhead">
<a href="?reverseSortBy=Name" title="Sort this column by descending order" class="sortdown">
<span> Name </span>
<img src="/geonext/images/skins/simple/schemes/dalmatian/indicator_sort_up.png" width="9" height="9" border="0" alt="This column is sorted by ascending order" title="This column is sorted by ascending order"> </a>
</th>
<th scope="col" align="left" valign="top" class="colhead">
<a href="?sortBy=Code" title="Sort this column by ascending order"> Course Code </a>
</th>
<th scope="col" align="left" valign="top" class="colhead">
<a href="?sortBy=class" title="Sort this column by ascending order"> Type </a>
</th>
</tr>
</thead>
<tbody>
<tr class="first odd">
<td align="center" valign="middle" class="">
<input type="checkbox" class="checkbox with-font" name="selectedID" id="selectedID2" value="2">
<label for="selectedID2"><span class="hidden"> 2</span></label>
</td>
<td class="sorted" align="Left">
<label for="selectedID2"><a href="/editcourse.geo?id=2">Dev ILT 1</a>
</label>
</td>
<td align="Left"> ILT1 </td>
<td align="Left"> Instructor Led </td>
</tr>
<tr class="even">
<td align="center" valign="middle" class="">
<input type="checkbox" class="checkbox with-font" name="selectedID" id="selectedID1" value="1">
<label for="selectedID1"><span class="hidden"> 1</span> </label>
</td>
<td class="sorted" align="Left">
<label for="selectedID22507408476"><a href="/editcourse.geo?id=1">Dev UDT 1</a></label>
</td>
<td align="Left"> UDT1 </td>
<td align="Left"> User Defined Task </td>
</tr> '
</tbody>
【问题讨论】:
-
请提供您的代码。
标签: html accessibility jaws-screen-reader nvda