无效输入的正确 Tab 键顺序是什么?

Whats the proper tab order for invalid inputs?

出于可访问性原因,表单中的第一个无效输入应该集中在表单提交上。这可以防止视力不佳的用户被迫寻找无效输入。

我的问题与 Tab 键顺序有关。在第一个无效输入获得焦点后,当用户再次单击 tab 时,焦点应该转到下一个无效输入还是按正常 tab 顺序转到下一个元素?

以这段伪代码为例。如果输入数字 2 和 4 有错误,当提交表单时,焦点将移动到输入数字 2。下一次用户按下 tab 键时,焦点是否转到输入 3 或 4?

<input id="1">
<input id="2"> <-- invalid
<input id="3">
<input id="4"> <-- invalid
<input id="5">
<button type="submit">

您使用的技术与 W3C 提出的技术完全不同 (G139: Creating a mechanism that allows users to jump to errors)

When users enter data input that is checked, and input errors are detected, a link to that error is provided so that the user does not have to search for it.

您的方法可能是“重新显示带有错误摘要的表单(未来 link)

在您的情况下,您不应修改 Tab 键顺序并仅显示缺失的字段,但您可以提供 button 以在所有字段之间或仅在缺失的字段之间切换视图。

The following fields were missing or invalid, please fill them below (or return to the full form)

以正常 Tab 键顺序聚焦下一个元素。 Tab 键顺序应保持为 1-2-3-4-5。