简体   繁体   English

Jaws屏幕阅读器跨浏览器不一致

[英]Jaws Screen Reader Cross Browser Inconsistency

So I have been trying to add proper aria tagging and html to some custom checkboxes and toggles, but found that they are not being read properly in JAWS on IE but they read fine on JAWS with chrome. 因此,我一直在尝试向某些自定义复选框和切换项添加适当的aria标记和html,但发现在IE的JAWS中无法正确读取它们,但在带有chrome的JAWS上可以正常读取。

Has anyone else experienced these issues and know the cause? 还有其他人遇到这些问题并知道原因吗?

Issue 1 : This should read as a switch, but on IE it reads as a button, chrome it reads switch. 问题1 :这应该读作一个开关,但是在IE上它读作一个按钮,Chrome读作开关。

Code 1 : 代码1

<div class="field">
  <input class="toggle-input" id="styleguide-toggle-demo" type="checkbox" name="Option Demo" value="option Demo" role="switch">
  <label class="toggle-label" for="styleguide-toggle-demo">
    <span class="toggle-message">Demo</span>
    <span class="toggle">
      <span class="knob"></span>
    </span>
  </label>
</div>

Issue 2 : The checkbox should read the label. 问题2 :复选框应读取标签。 Currently in IE it only reads the checked state of the checkbox, while in chrome it reads the label and the checked state. 当前在IE中,它仅读取复选框的选中状态,而在chrome中,它读取标签和选中的状态。

Code 2 : 代码2

<label for="styleguide-checkbox-A">
  <input id="styleguide-checkbox-A" class="input-checkbox" type="checkbox" name="styleguide-checkbox-A" value="styleguide-checkbox-option-A">
  <span>Option A</span>
</label>

ISSUE 1: A couple of things: 问题1:有两件事:

  1. when using role="switch" you must also use the aria-checked attribute set to either true or false. 使用role =“ switch”时,还必须使用aria-checked属性设置为true或false。 ( https://www.w3.org/TR/wai-aria-1.1/#switch ) https://www.w3.org/TR/wai-aria-1.1/#switch
  2. currently JAWS does not recognize the switch role. 当前,JAWS无法识别切换角色。

ISSUE 2: labeling with nested elements can cause havoc. 问题2:使用嵌套元素进行标签会造成严重破坏。 I assume you are using span to style the label. 我假设您正在使用span来设置标签样式。 Try this instead and style the label element: 尝试以下方法并设置标签元素的样式:

<div class="form-row">
  <input id="styleguide-checkbox-A" class="input-checkbox" type="checkbox" name="styleguide-checkbox-A" value="styleguide-checkbox-option-A" />
  <label for="styleguide-checkbox-A">Option A</label>
</div>

Using role=switch on <input type='checkbox'> is not valid. <input type='checkbox'>上使用role = switch无效。

https://www.w3.org/TR/html51/sec-forms.html#checkbox-state-typecheckbox https://www.w3.org/TR/html51/sec-forms.html#checkbox-state-typecheckbox

Allowed ARIA role attribute values: checkbox (default - do not set) or menuitemcheckbox. 允许的ARIA角色属性值:复选框(默认-不设置)或menuitem复选框。

You would use role=switch if you are creating your own switch component made out of <div> or <span> tags. 如果要创建由<div><span>标记组成的自己的开关组件,则可以使用role = switch。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM