简体   繁体   English

屏幕阅读器和HTML文档重点

[英]Screen reader and HTML document focus

I'm new to this whole ARIA and accessibility aspect of HTML. 我是HTML的整个ARIA和可访问性方面的新手。 I have an app where most of the things work properly with screen readers. 我有一个应用程序,其中大部分内容均可与屏幕阅读器一起正常使用。 However, when I click away from any control, ie focus on the document, NVDA always reads " page title document". 但是,当我单击任何控件时(即将焦点放在文档上),NVDA始终读取“ 页面标题文档”。 I've been trying to stop it from doing that for a while but unsuccessfully. 我一直试图阻止它这样做一段时间,但未成功。

The best thing I came up with is to add tabindex=0 to my topmost DIV so that it would receive focus on click instead of document, but even then NVDA reads the word "section" when it gets focused. 我想到的最好的办法是将tabindex=0添加到最上面的DIV以便它将焦点集中在单击而不是文档上,但是即使这样NVDA也会在焦点对准时读取“节”一词。 Is there a way to suppress this? 有没有办法抑制这种情况?

I also tried removing title and adding it back in in a short timeout and then reader says just the word "document" which is fine, but depending on JS activity timeout sometimes flickers empty title as it is executed not that consistently. 我也尝试过删除标题,并在短时间内将其添加回去,然后读者说“ document”一词很好,但是取决于JS活动超时,有时会闪烁空标题,因为执行的不一致。 And requestAnimationFrame is too short, reader doesn't have time to pick the empty title and reads it anyway. 而且requestAnimationFrame太短,读者没有时间选择空标题,反正也可以读取它。

When you click on the document body, it will become focused and the previously focused control will blur. 当您单击文档主体时,它将变为聚焦状态,并且先前聚焦的控件将模糊。 Screen reader will reflect this change by reading the accessible name of the newly focused widget, namely the document title. 屏幕阅读器将通过阅读新聚焦的窗口小部件的可访问名称(即文档标题)来反映此更改。 This is perfectly normal and entirely expected behavior, there is no need to change that. 这是完全正常的行为,完全是预期的行为,无需更改。

You need to keep in mind that your expectations as a sighted developer are entirely not the same as any user, much less visually impaired user. 您需要牢记,作为有远见的开发人员,您的期望与任何用户都不相同,而视障用户则要少得多。 What seems natural and expected to you will be highly confusing to a blind person. 盲人会感到很自然,而且对您期望很高。

Try being in their place for a while. 尝试在自己的位置呆一会儿。 Put a sleep mask over your eyes and try using your app relying only on keyboard and screen reader. 戴上睡眠面膜,然后尝试仅依靠键盘和屏幕阅读器使用您的应用程序。 I do that often, and it's a very enlightening experience. 我经常这样做,这是非常令人启发的经历。

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

相关问题 在 HTML 和 JavaScript 中设置屏幕阅读器(对讲)的初始焦点 - Setting the Screen reader(talkback)'s initial focus in HTML and JavaScript 在ember中将屏幕阅读器的焦点设置为模态警报 - Setting focus of a screen reader on a modal alert in ember NVDA屏幕阅读器无法预测切换到对焦模式 - NVDA screen reader not switching to focus mode predictably 如何让屏幕阅读器停止将 HTML5 游戏视为文档? - How can I get a screen reader to stop treating an HTML5 game like a document? 屏幕阅读器 - 仅阅读具有 role="alert" 而不是焦点的元素 - Screen reader - Only read element with role="alert" and not on focus 打开后如何将屏幕阅读器焦点更改为 vuetify 模态? - How to change screen reader focus to vuetify modal once it opens? 屏幕阅读器无法读取React组件中的html元素 - Screen reader is not reading html element in react component HTML 页面中用于标题的屏幕阅读器可访问性 - Screen reader accessibility in HTML page for headings 如何防止屏幕阅读器焦点(不是指键盘焦点)离开预定义区域(例如,模态) - How to prevent screen reader focus (not referring to keyboard focus) from leaving predefined area (e.g., modal) 如何检查屏幕阅读器是否在html5应用程序中运行 - how to check screen reader is running in html5 application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM