像NVDA这样的屏幕读取器如何自动读取从显示:无阻止的元素? Aria-Live效果不佳

发布于 2025-01-25 15:47:25 字数 349 浏览 0 评论 0原文

我有一种复杂的多列形式页面加载时可见。

但是,默认情况下,我需要在加载页面时隐藏此表格。仅当用户单击页面上的“显示表单”链接时,才会出现此表单,从“显示:无”到“显示:block”中设置表单。

默认情况下,我单击“显示表单”后,读者不会自动读取表格。

因此,我在形式中添加了Aria-live =“礼貌”。当我单击“显示表单”链接时,读者将阅读表格,但是阅读非常差 - 情况变好了,咏叹调标签被忽略,阅读流量中断等。

因此,我的问题是,使用屏幕阅读器NVDA,如何在加载页面后,如何清理准确地读取从显示:无要显示的元素:block(基于某些用户互动)?

如上所述,只有在页面加载时可见表格时,我才能获得完美的阅读。

I have a complex multi-column form that the NVDA screen reader reads perfectly well after the page loads, including aria-labels, fields, order of elements, etc. In this working scenario, the form is fully visible when the page loads.

However, I need to hide this form by default when the page loads. This form should only appear if the user clicks a "Show form" link on the page, setting the form from "display: none" to "display: block".

By default, the reader won't automatically read the form after I click "Show form".

So I added aria-live="polite" to the form. The reader will read the form when I click the "Show form" link, but the reading is very poor - things gets mixed, aria-labels get ignored, the reading flow breaks, etc.

So my question is, using a screen reader like NVDA, how do I get a clean and accurate reading of an element that goes from display: none to display: block (based on some user interaction) after the page is loaded?

As I mentioned above, I get a perfect reading only if the form is visible when the page loads.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情场扛把子 2025-02-01 15:47:26

ARIA Live区域仅在两次中读取:

  • ,在DOM中添加它们时
  • 当它们的内容在所有其他情况下变化时

,如果必须读取是否必须读取它们,则尚未正式指定它们。它们与一些浏览器 +屏幕读取器组合在一起,但没有其他浏览器。

无论如何,阅读整个表单部分都不是一个好主意。

如果用户可以很好地期望出现某种东西,那么使其自然能够到达要比宣布它出现的事实要重要得多。通过自然到达,我的意思是通过选项卡和浏览器光标命令,例如箭头键或从形式元素到形式元素导航。
特别是,这意味着您应该避免在身体末端添加新内容,而是将其添加到真正期望的DOM中。

正确完成此操作后,您可能会考虑宣布出现表单部分。您不应该使全新的部分被阅读,而应该坚持一条简单的一般消息,例如“出现在一般信息下方的个人信息部分”。这种信息必须是在ARIA LIVE地区。
如果从用户的角度出乎意料地出现了表单部分,则此公告可能确实有用。如果非常期待发生的事情,那么如果您使它出现在正确的位置,则该公告是相对可选的。

Aria live regions are only read in two occasions:

  • When they are added in the DOM
  • When their content changes

IN all other cases, it isn't officially specified if they must be read or not. They are with some browsers + screen readers combinations, but not with some others.

IN any way, it isn't a good idea to read an entire form section.

If the user can quite well expect something to appear, it's much more important to make it naturally reachable, than to announce the fact that it appeared. By naturally reachable, I mean both by tab and by browser cursor commands like arrow keys or navigation from form element to form element.
In particular, it means that you should for example avoid adding new content at the end of the body, but rather add it in the DOM where it is really expected instead.

Once this is correctly done, at that moment you may think about announcing that the form section appeared. You shouldn't make the whole new section being read, but stick to a simple general message, like "Personal information section appeared below general information". This kind of message has to be in an aria live region.
If that form section appears quite unexpectedly from the user point of view, this announcement can be really useful. If what happens is quite expected, that announcement is relatively optional, if you have made it appear at the right place.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文