简体   繁体   English

辅助功能和链接 - 屏幕阅读器将链接文本的每一行作为单独的链接读取

[英]Accessibility and Links - Screen reader reads each line of link text as a separate link

I have sent the site i'm working on to someone who checks whether its accessable or not, and the test came back with a reject regarding some links in the site.我已将我正在开发的网站发送给检查其是否可访问的人,并且测试返回时拒绝了该网站中的某些链接。

There are 7 links, each of them in their own hoverable box, and in each box there is text, a headline and about 3-4 lines of more details.有 7 个链接,每个链接都在自己的可悬停框中,每个框中都有文本、标题和大约 3-4 行的详细信息。 I'm happy with the design itself (visually) and want to stick with it.我对设计本身(视觉上)很满意,并希望坚持下去。

Initially, the code looked like this:最初,代码如下所示:

<a href=# target="_blank" rel="noopener noreferrer">
    <strong> some headline </strong>
    <span> info1 <br/> info2 <br/> info3 </span>
</a>

the screen reader reads it like this: "link - some headline", and then "link - info1" and so on... even though its a single link!屏幕阅读器是这样读的:“链接 - 一些标题”,然后是“链接 - info1”等等......即使它是一个链接!

After reading some about accessibility, I decided to not use the <br> element, since it causes problems in screen reading.在阅读了一些关于可访问性的内容后,我决定不使用<br>元素,因为它会导致屏幕阅读问题。

And so, I changed it to:因此,我将其更改为:

<a href=# target="_blank" rel="noopener noreferrer">
    <p><strong>some headline</strong>
       info1
       info2
       info3
    </p>
</a>

with css handling the break lines with the property "white-space: pre-line;"使用 css 处理具有“空白:前线”属性的断线; applied to <p> element.应用于<p>元素。

Surprisingly, the screen reader still has the same problem.令人惊讶的是,屏幕阅读器仍然存在同样的问题。 How can that be?这个怎么可能? there is only one <a> element.只有一个<a>元素。

I also tried switching places between <a> and <p> , to get a similar result and it also messed up the design.我还尝试在<a><p>之间切换位置,以获得类似的结果,但它也搞砸了设计。

Follow-up: Could it be that their reader is just not working well?追问:会不会是他们的阅读器不好用? I had that suspicion我有这个怀疑

Would love to get some insight on this, thank you.想了解一下这方面的知识,谢谢。

When I started making my sites accessible, I downloaded a few addons (to simulate a reader) and a few readers.当我开始使我的网站可访问时,我下载了一些插件(以模拟阅读器)和一些阅读器。 The result was that they had different rules.结果是他们有不同的规则。

Myth 4: All screen readers are exactly the same Not all screen readers are compatible (or as compatible) with every operating system, browser, and app, and user interfaces can differ considerably.误区 4:所有屏幕阅读器都完全相同 并非所有屏幕阅读器都与每个操作系统、浏览器和应用程序兼容(或兼容),用户界面可能会有很大差异。 Someone who's adept at Apple's VoiceOver may encounter a learning curve when switching to Android's TalkBack.精通 Apple VoiceOver 的人在切换到 Android 的 TalkBack 时可能会遇到学习曲线。 Users will have their favorites, which is another reason that developers shouldn't test their content in a single computing environment.用户会有他们的最爱,这是开发人员不应该在单一计算环境中测试他们的内容的另一个原因。

From Bureau of Internet Accessibility来自互联网无障碍局

Mozilla guide talks about striking a balance. Mozilla 指南谈到了如何取得平衡。

ARIA Screen Reader Implementors Guide Live Regions This is just a guide. ARIA 屏幕阅读器实施者指南 Live Regions 这只是一个指南。 Live region markup is a complex area which is somewhat open to interpretation.实时区域标记是一个复杂的领域,在某种程度上可以解释。 The following is intended to provide implementation guidance that respects screen readers developers' need to try different things.以下旨在提供尊重屏幕阅读器开发人员需要尝试不同事物的实施指南。 The intention is to strike a balance between providing useful guidance on how to use the markup's intended meaning while supporting live regions as an area for screen readers to innovate and compete.目的是在为如何使用标记的预期含义提供有用的指导和支持实时区域作为屏幕阅读器创新和竞争的区域之间取得平衡。

From Mozilla Guide on Aria来自Aria 的 Mozilla 指南

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

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