html – 508投诉表格标题中的“全选”复选框

我有一个如下所示的数据表:

<table><thead>
<tr>
<th><input type="checkbox" /></th>
<th scope="col">Foo</th>
<th scope="col">Bar</th><tr>
</thead>
<tbody>
<tr><td><input type="checkbox" /></td><td scope="row">a</td><td>b</td></tr>
<tr><td><input type="checkbox" /></td><td scope="row">c</td><td>d</td></tr>
</tbody></table>

我希望标题中的复选框选中正文中的所有复选框.我写了Javascript来做选择,它工作正常.但是,在IE7和IE8中(可能是其他浏览器,但我们不需要支持其他任何东西),标题中的复选框永远不会得到标签焦点,所以我们失败了508.

有没有办法处理这个没有设置tabindexes的一切?

最佳答案 正如Jukka在评论中所说,所有这些都需要标签.没有< label>表单元素将自动失败任何508检查.这可能是它抛出的真正错误,但我们需要知道正在使用的工具.

回答你的新问题:

Anyway, the real issue here is not that it doesn’t get focus, but that the focus isn’t visible. I tried adding a label, and that didn’t help, and I tried just adding text to the TD and that didn’t help either

大多数浏览器在获得焦点时在所有元素周围放置一个1像素的虚线边框.浏览样式表,找出类似outline:none;的内容.您应该删除该行或添加一个重新添加焦点的新规则.

点赞