简体   繁体   English

aria-live =“礼让”不会宣布选中的表单控件(如单选按钮/复选框)

[英]aria-live=“polite” doesn't announce selected form controls like radio button/checkbox

Facing a strange problem with aria-live="polite" , if the loaded content has form controls, like radio buttons or checkbox. 如果加载的内容具有表单控件(如单选按钮或复选框),则aria-live="polite"遇到一个奇怪的问题。

NVDA just reads the text of radio buttons, but doesn't announce anything about which one is selected or checked. NVDA只会读取单选按钮的文本,但不会宣布有关已选择或选中哪个按钮的任何信息。

<a aria-label="Click Me" href="#">Click Me</a>
<div id="myForm" aria-live="polite"></div>

Here is the plunker . 这是the

Sorry you haven't gotten a good answer yet. 抱歉,您还没有得到一个好的答案。 Welcome to the world of accessibility. 欢迎来到无障碍环境。

Your issue isn't with aria-live=“polite” -- it's just the way that NVDA works. 您的问题与aria-live=“polite”无关,它只是NVDA工作的方式。 So I guess the good news is you did it right. 所以我想这是个好消息,您做对了。 For the following example I changed the default option to "Two Day" so I could confirm what was being read wasn't just the first option. 在下面的示例中,我将默认选项更改为“两天”,因此我可以确认正在读取的内容不仅是第一个选项。

With your code, I hear: 通过您的代码,我听到:

Click me link 点击我链接

I then press SPACE to activate the link, and I hear: 然后,我按SPACE键激活链接,然后听到:

Choose a shipping method: 选择运送方式:

Overnight 过夜

Two day <-- You want this to say "selected/checked/etc" 两天<-您要说“已选择/已检查/已选中”

Ground 地面

If I tab into the group, I hear: 如果我进入该群组,则会听到:

Choose a shipping method: 选择运送方式:

radio button not checked Two day 单选按钮未选中两天

To get your desired behavior I updated your HTML to generate an invisible <span> that contains the text Default is "Two day" . 为了获得所需的行为,我更新了HTML以生成不可见的<span> ,其中包含文本Default is "Two day" Now what I hear is: 现在我听到的是:

Click me link 点击我链接

I then press SPACE to activate the link, and I hear: 然后,我按SPACE键激活链接,然后听到:

Choose a shipping method default is Two Day: 选择一种送货方式,默认值为“两天”:

Overnight 过夜

Two day 2天

Ground 地面

This is what it looks like (Note the span inside the legend): 外观如下所示(注意图例中的跨度):

<fieldset role="radiogroup" aria-labelledby="shipMethod" id="myFieldSet">
    <legend id="shipMethod">Choose a shipping method<span style="display:none;"> Default is "Two day"</span>:</legend>
    <input name="shipping" id="overnight" type="radio" value="overnight">
    <label for="overnight">Overnight</label>
    <br>
    <input name="shipping" id="twoday" type="radio" value="twoday" checked="checked">
    <label for="twoday">Two day</label>
    <br>
    <input name="shipping" id="ground" type="radio" value="ground">
    <label for="ground">Ground</label>
</fieldset>

You can also get a similar affect by messing around with changing the control focus, but that's a bit un-cool to the user with a screen reader. 您还可以通过更改控件焦点来获得类似的效果,但这对于使用屏幕阅读器的用户来说有点不酷。

This isn't hard to implement and in a way is a kind of elegant in that the users that need the extra help get it without changing it for other users. 这并不难实现,并且某种程度上是一种优雅,因为需要额外帮助的用户可以在不为其他用户更改的情况下获得它。

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

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