您可以强制屏幕阅读器将数字读取为单个数字吗? [英] Can you force a screen reader to read numbers as individual digits?

查看:165
本文介绍了您可以强制屏幕阅读器将数字读取为单个数字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

电话号码通常是全数字,忽略括号,破折号,加号等,因此电话号码的输入字段通常是数字。

Phone numbers are typically all digits, ignoring parens, dashes, pluses, etc., so input fields for phone numbers are typically numeric.

当屏幕阅读器遇到一个数字输入字段,它将以整数形式读取该值。例如,如果我有一个美国电话号码的三个输入字段,第一个是区号(3位数字),然后是交换(3位数字),然后是行(4位数字)(如果这些字段有123、456) ,分别是7890,我们通常所说的数字是一二三,四五六,七,八,九,零。

When a screen reader encounters a numeric input field, it'll read the value as a whole number. For example, if I had three input fields for a US phone number, with the first being the area code (3 digits), then the exchange (3 digits), then the line (4 digits), if the fields have 123, 456, 7890 (respectively), the way we'd normally say that number is "one two three", "four five six", "seven, eight, nine, zero".

但是当屏幕阅读器遇到这些字段时,它会说一百二十三,四百六十六,七千八百九十。

But when a screen reader encounters those fields, it says "one hundred twenty-three", "four hundred fifty-six", "seven thousand eight hundred ninety".

我认为屏幕阅读器用户习惯于听到大号码的电话号码(至少我已经与之交谈过的人希望如此),但这并不意味着我们无法使其更好。如果我要问这些人中的一个人的电话号码,他们将不会使用大数字,而是使用单个数字。

I think screen reader users are used to hearing phone numbers as big numbers (at least the guys I've talked to expect that), but that doesn't mean we can't make it better. If I were to ask one of these guys for their phone number, they wouldn't use big numbers but rather individual digits.

我尝试了各种< input>类型和查看了所有角色,状态和属性,但看不到内置的任何可以强制读取数字的内容。

I tried various <input> types and looked through all the roles, states, and properties but don't see anything built in that can force digits to be read.

我所能想到的就是通过在视觉上隐藏的< span>来编码它,其中包含数字作为单独的数字,< span id ='foo' > 1 2 3< / span>,然后具有< input aria-labelledby ='foo'>。

All I can think of is to code around it by having a visually hidden <span> that contains the number as separate digits, <span id='foo'>1 2 3</span>, then having <input aria-labelledby='foo'>.

有更好的方法吗?

推荐答案

在有限的浏览器支持下,您可以尝试CSS3属性:

With limited browser support, you can try CSS3 property:

speak:spell-out;

最好的方法是使用 aria-label 以提供足够的停顿时间以方便的阅读格式:

Best way is to use aria-label to give a convenient reading format with the sufficient pause:

<span aria-label="1 2 3. 4 5 6. 7 8 9 0">123 456 7890</span>

您还可以使用 hCard微格式 ,可以通过某些技术进行解释,并使用国际格式的电话号码(其他)

You can also use a hCard microformat which can be interpreted by some technologies and use a phone number in international format (which can be used by other) combined with the previous method

<p class="h-card">
  <span class="p-tel" aria-label="1 2 3. 4 5 6. 7 8 9 0">+123 456 7890</span>
</p>

TL; DR:使用国际格式, aria-label ,hCard微格式和 speak:spell-out CSS属性

TL;DR: use international format, aria-label, hCard microformat and speak:spell-out CSS property

这篇关于您可以强制屏幕阅读器将数字读取为单个数字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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