你能通过所有单选按钮选项卡吗? [英] Can you tab through all radio buttons?

查看:97
本文介绍了你能通过所有单选按钮选项卡吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个单选按钮列表。当我通过他们标签时,似乎只有第一个单选按钮或选中的单选按钮将会聚焦,其余的单选按钮将被跳过。复选框没有这个问题。

I have a list of radio buttons. when I tab through them, seems like only the first radio button or the one that is selected will get focused, the rest of the radio buttons will get skipped. checkbox didnt have this problem.

http://jsfiddle.net/2Bd32/

我很难向我的QA解释这不是一个错误。

I have a hard time to explain to my QA this is not a bug. can someone please explain to me why this happens.

Soccer: <input type="checkbox" name="sports" value="soccer"  tabindex="1" /><br />
Football: <input type="checkbox" name="sports" value="football"  tabindex="2" /><br /> 

<input type="radio" name="num" value="3" tabindex="3">3<br>
<input type="radio" name="num" value="4" tabindex="4">4<br>
<input type="radio" name="num" value="5" tabindex="5">5<br>
<input type="radio" name="num" value="6" tabindex="6">6<br>
<input type="radio" name="num" value="7" tabindex="7">7<br>

Baseball: <input type="checkbox" name="sports" value="baseball"  tabindex="8"  /><br /> 
Basketball: <input type="checkbox" name="sports" value="basketball"  tabindex="9"  />


推荐答案

您可以引用W3C作为您的源代码,这里 here。

You can cite the W3C as your source, here and here.

实质上,一个单选按钮是一组作为单个元素的组,因为它只保留一个值。标签到收音机组会将您带到第一个项目,然后使用您在组内导航的箭头键。

Essentially a radio button is a group that functions as a single element since it retains only a single value. Tabbing to a radio group will bring you to the first item and then using the arrow keys you navigate within the group.


  • 重点可以通过以下方式移动到广播组:
    • Tab键
    • 定位到标签的访问键或助记符
      激活标签(通过辅助技术机制)
  • Tab键将焦点
    移动到组中的第一个单选按钮,但不选择无线电
    按钮。
  • Shift + Tab键将焦点移到组中的最后一个电台
    按钮,但不会选择单选按钮。
  • 向上箭头键按下可将焦点和
    选择向前移动通过组中的单选按钮。如果第一个
    单选按钮具有焦点,则焦点和选择会移至组中最后一个
    单选按钮。
  • 使用向下箭头键将焦点
    向后移动,并通过组中的单选按钮向后移动。如果
    最后一个单选按钮具有焦点,则焦点和选择会移至组中的
    第一个单选按钮。 *空格键按键检查当前有焦点的
    单选按钮。当
    重新进入该组时,焦点返回到前一个焦点
    (具有选择集的项目)的位置。
  • 按Tab键退出
    组,并将焦点移至下一个表单控件。

  • Shift + Tab键退出该组并将焦点移至前一个
    表单控件。

这篇关于你能通过所有单选按钮选项卡吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆