如何处理屏幕阅读器的版本号? [英] How to handle version numbers for screen readers?

查看:165
本文介绍了如何处理屏幕阅读器的版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Windows Narrator,而版本号2.3.96则被读者视为"1996年3月2日".如何处理屏幕阅读器的版本号?我看到一些使用标签建议的答案,并拼出了点,例如:aria-label="2 dot 3 dot 96".有更好的方法吗?

解决方案

简短回答

使用<p aria-label="Version 2 point 3 point 96">Version 2.3.96</p>,将在大多数流行的屏幕阅读器中正确解析.确保没有<spans>从文本中拆分版本号,将aria-label用作替代/备份.

长答案

通常,我建议从不干扰屏幕阅读器的发音方式,如@QuentinC所建议的那样.

但是,在这种情况下,我会说您要做要尝试解决此问题,因为听到日期读应该有版本号的情况可能会非常令人困惑(是软件是书面的,是公司成立的日期吗?谁知道!).

这是屏幕阅读器中的一个解析问题,与大多数人不喜欢阅读某些内容的问题有很大不同,请仅遵循以下有关此示例的建议.

修正一个,更改您的标记.

您没有添加标记,但是以下说明基于我的测试.

通过在版本号之前添加"Version",此问题实际上可以自行解决(至少在我测试的JAW,NVDA和VoiceOver中).

我的猜测是您的版本号与以下格式相似:

<p>Version <span>2.3.96</span></p><p>2.3.96</p>没有单词版本".

在第一个示例JAWS,NVDA和VoiceOver中删除<span>可以在我的测试中正确阅读以下内容:

<p>Version 2.3.96</p>

一旦在版本号周围添加了<span>,数字的上下文就会丢失(<span>元素中的文本将自行评估),因此屏幕阅读器将尝试自行解析它,而没有任何上下文,并确定它是一个日期.

确定使用aria-label可以解决该问题吗?

aria-label可能不适用于没有role表示它们是活动元素的静态元素(<div><span>等),因此很可能对您还是无效.

由于这个原因,我不建议您尝试单独使用aria-label来解决此问题,但是将它添加到确实考虑了这一点的屏幕阅读器上,是一个不会受到伤害的步骤.

这是我唯一一次建议干扰屏幕阅读器的通话方式,请不要将此作为解决其他发音问题的步骤,因为这是解析问题,而不是发音问题.

考虑到这一点,我建议您使用以下内容:

<span aria-label="Version 2 point 4 point 99">Version 2.4.99</span>

周围带有<span><p>或其他内容块.

I'm using Windows Narrator and a version number like 2.3.96 is being reader as a date "2nd March, 1996". How do I handle version numbers for screen readers? I see some answers suggested using a label and spell out the dots, like: aria-label="2 dot 3 dot 96". Is there a better way to do this?

解决方案

Short Answer

Use <p aria-label="Version 2 point 3 point 96">Version 2.3.96</p>, this will get parsed correctly in most popular screen readers. Make sure there are no <spans> splitting the version number from the text, use an aria-label as overkill / a backup.

Long Answer

Normally I would advise to never interfere with the way a screen reader pronounces things, as @QuentinC has suggested.

However in this circumstance I would say that you do want to try and fix this problem, as hearing a date read where there should be a version number could be very confusing (was it the date the software was written, is it the date the company was formed? Who knows!).

This is a parsing problem in the screen reader, very different from problems most people have where they don't like the way something is read, please only follow the advice below for this one example only.

Fix one, change your markup.

You didn't add your markup but the below explanation is based on my testing.

This problem will actually fix itself (at least in JAWs, NVDA and VoiceOver from my testing) by simply adding 'Version' before the version number.

My guess is you have the version number in a format similar to the following:

<p>Version <span>2.3.96</span></p> or <p>2.3.96</p> without the word 'version'.

By removing the <span> in the first example JAWS, NVDA and VoiceOver read the following correctly in my testing:

<p>Version 2.3.96</p>

Once the <span> is added around the version number the context of the numbers is lost (text within <span> elements is evaluated on it's own) so a screen reader will try and parse it on it's own, without any context, and decide it is a date.

Surely using aria-label will fix it though?

Also aria-label will probably not work on static elements (<div>, <span> etc.) that do not have a role that indicates they are an active element, so odds are it will not work anyway for you.

For that reason I would not recommend trying to fix this problem with aria-label alone, however adding it for the screen readers that do take it into consideration is a step that would not hurt.

This is the only time I have ever recommended interfering with how a screen reader talks, please do not take this as a step to solve other pronunciation problems as this is a parsing problem not a pronunciation problem.

Taking that into account I would recommend you use the following:

<span aria-label="Version 2 point 4 point 99">Version 2.4.99</span>

With either a <span>, <p> or other content block surrounding it.

这篇关于如何处理屏幕阅读器的版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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