简体   繁体   English

使屏幕阅读器将“ 16”读为“十六”

[英]Make screen reader read “16” as “sixteen”

I currently have a form element with a label: 我目前有一个带有标签的表单元素:

<label for="number">16-digit number</label>

This is read out by OS X El Capitan's VoiceOver Utility as "1 6 digit number" but I would like to get this to read as "Sixteen digit number" . 这是由OS X El Capitan的VoiceOver Utility读出的,是“ 1 6位数”,但我想读为“ 16位数” Is this possible? 这可能吗? If so, how? 如果是这样,怎么办?

I have tried the following: 我尝试了以下方法:

<label for="number"><span>16</span>-digit number</label>
<label for="number"><span style="speak-numeral: continuous !important;">16</span>-digit number</label>
<label for="number"><span style="speak-as: normal !important;">16</span>-digit number</label>
<label for="number"><span style="speak-numeral: continuous !important; speak-as: normal !important;">16</span>-digit number</label>

And possibly some other option I cannot remember. 可能还有其他我不记得的选择。 Any suggestions would be gratefully received. 任何建议将不胜感激。


If anyone finds this after a struggle, please comment with some of your failed search terms to help others find this useful info. 如果有人在奋斗后发现此问题,请用一些失败的搜索词发表评论,以帮助其他人找到此有用信息。 Thanks. 谢谢。

Maybe: 也许:

<label for="number">
  <span class="sr-only">sixteen</span>
  <span aria-hidden="true">16-</span>
  digit number
</label>

Where sr-only is: 其中sr-only是:

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

After calculating text alternative for the label (" 16-digit number "), it reads it as well as possible considering 16-digit as a single word (and some sort of alphanumeric acronym). 计算完标签的替代文本(“ 16位数字 ”)后,它会尽可能考虑将16位作为单个单词(以及某种字母数字首字母缩写词)进行读取。

So the different CSS instructions you put inside the label tag can't have any effect because the text alternative has already been computed. 因此,放入label标签中的不同CSS指令不会产生任何效果,因为已经计算出了替代文本。

You can use aria-label : 您可以使用aria-label

<label for="number" aria-label="16 digit number">16-digit number</label>

You can also try to add an invisible pause, or some kind of character in place/supplement of the hyphen. 您也可以尝试添加一个不可见的暂停,或某种形式的字符代替/补充连字符。 The following might work depending on the way Voiceover calculates text. 根据Voiceover计算文本的方式,以下操作可能会起作用。

<label for="number">16-&shy;digit number</label>
<label for="number">16&dash;digit number</label>

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

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