简体   繁体   English

屏幕阅读器:将用于屏幕阅读器的其他文本添加到选择框

[英]Screen reader: adding additional text for screen reader into selectbox

How to add a text for screen reader only so that it is pronounced 如何仅为屏幕阅读器添加文本使其发音

Volvo selected, Saab selected, Mercedes selected, Audi selected

instead of 代替

Volvo, Saab, Mercedes, Audi

respectively. 分别。 Adding 新增中

<span class="sr-only">selected</span>

into 进入

<select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

doesn't help. 没有帮助。

Any ideas? 有任何想法吗? Thank you. 谢谢。

ARIA text and labels can solve this and provide information for a screen reader. ARIA文本和标签可以解决此问题,并为屏幕阅读器提供信息。 For example the following would label the letter 'x' as being a close button. 例如,以下内容会将字母“ x”标记为关闭按钮。

<button aria-label="Close" onclick="myDialog.close()">X</button>

The above example comes from here: Aria Label Attribute 上面的示例来自此处: Aria标签属性

Read more about other ARIA roles, attributes, and techniques . 阅读有关ARIA其他角色,属性和技术的更多信息

ARIA labels are your solution, yes. 是的,ARIA标签是您的解决方案。 However, you shouldn't do this in any way. 但是,您不应以任何方式执行此操作。
the info about what is selected and what is not is provided by screen reader itself. 屏幕阅读器本身会提供有关选定内容和未选定内容的信息。 More than that, if you design a multi-select list box (ie, with a multiple attribute), and your user enters the box and presses Shift+F8 , he/she will hear something like this: 不仅如此,如果您设计一个多选列表框(即具有multiple属性),并且您的用户输入该框并按Shift+F8 ,他/她将听到以下内容:

Volvo selected selected Saab selected selected 沃尔沃选择选定萨博选择选定

This is really, really annoying, believe me. 相信我,这真的很烦人。 So just don't bother with it and provide a standard accessible (multi-select, if needed) list box. 因此,只需不必理会它,并提供一个标准的可访问列表(如果需要,可以选择)。

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

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