简体   繁体   English

NVDA 屏幕阅读器读取文本上的可点击单词

[英]NVDA screen reader reads clickable word on text

Any idea why NVDA reads clickable word when tabbing through text in html example:知道为什么 NVDA 在 html 示例中的文本中读取可点击单词:

<h1 tabindex="1"> testing </h1>

NVDA will read clickable testing NVDA 将读取可点击测试

Short answer:简短的回答:

the tabindex attribute implies functionality to some screenreaders. tabindex 属性暗示了某些屏幕阅读器的功能。

Long answer:长答案:

Two primary ways that a screen reader user will navigate your webpage are by skipping through interactive elements or by headings.屏幕阅读器用户浏览网页的两种主要方式是跳过交互式元素或标题。 Interactive elements are things like links, buttons, form fields and any other piece of functionality that the user will initiate on your page.交互元素是链接、按钮、表单域和用户将在您的页面上启动的任何其他功能。 These are navigated by using the 'tab' key.这些是通过使用“tab”键来导航的。

The other primary way they will navigate your page is by headings.他们浏览您页面的另一种主要方式是通过标题。 In fact, a survey from webaim lists headings overwhelmingly as the primary method of navigating a page to find information ( source ).事实上,webaim 的一项调查将标题列为绝大多数导航页面以查找信息的主要方法(来源)。 In your example, you have given the heading a tabindex which will give the impression that it has some functionality or interactivity to it.在您的示例中,您为标题提供了一个 tabindex,这会给人一种它具有某些功能或交互性的印象。 To my understanding, both JAWS and NVDA will read out 'clickable' on elements that have a tabindex, as they could easily (and typically would) have some javascript click handlers that are not evident from the screenreader.据我了解,JAWS 和 NVDA 都会在具有 tabindex 的元素上读出“可点击”,因为它们很容易(并且通常会)有一些在屏幕阅读器中不明显的javascript点击处理程序。

In first place remember that tabindex are not a good practice in a11y, and also headers don't need a tabindex NVDA provides a header navigation with the H key.首先请记住,tabindex 在 a11y 中不是一个好习惯,而且标题不需要 tabindex NVDA 提供了带有 H 键的标题导航。 About the clickable I can say from my experience is a known issue for NVDA, if you check that in other SR (Voice over or Chromebox) should be read properly关于可点击,根据我的经验,我可以说是 NVDA 的一个已知问题,如果您检查在其他 SR(Voice over 或 Chromebox)中是否应该正确读取

Answer:回答:

It's because of attribute tabindex which makes this element keyboard focusable.这是因为属性tabindex使此元素键盘可聚焦。 One can focus it by pressing TAB key on a keyboard.可以通过按键盘上的 TAB 键来聚焦它。

Hint #1: Attribute tabindex with value above 0 should be generally avoided!提示#1:通常应避免使用值大于 0 的属性tabindex

Don't use tabindex="1" , tabindex="2" and so on.不要使用tabindex="1"tabindex="2"等等。 Only tabindex="0" or tabindex="-1" can be useful in some cases.在某些情况下,只有tabindex="0"tabindex="-1"才有用。 Otherwise you can create a complete mess for a user experience.否则,您可能会为用户体验造成一团糟。

Read more:阅读更多:

Hint #2: Generally no need to make focusable elements that a user cannot interact with.提示#2:通常不需要制作用户无法与之交互的可聚焦元素。

As in specific case no sense to make a heading element keyboard focusable if a user cannot interact with it.在特定情况下,如果用户无法与其交互,则使标题元素键盘可聚焦是没有意义的。

If you are concerned about screen reader users have no worries as they read non focusable content just fine.如果您担心屏幕阅读器,用户就不用担心,因为他们阅读不可聚焦的内容就好了。 A quote from Accessibility Developer Guide : As opposed to keyboard only users, screen reader users usually do not use the Tab key to read a page!来自辅助功能开发人员指南的引用:与仅使用键盘的用户相反,屏幕阅读器用户通常不使用 Tab 键来阅读页面! Read the "Screen readers browse and focus modes" to know the difference between navigation using Arrow keys and Tab key.阅读“屏幕阅读器浏览和聚焦模式”以了解使用箭头键和 Tab 键导航之间的区别。

But... Exception to the rule exists但是......规则的例外存在

Exception to the rule exists and it's probably a good idea in cases where developers set tabindex="-1" to headings which they want the focus to be moved programmatically for the purpose of accessibility.存在规则的例外情况,如果开发人员将tabindex="-1"为他们希望以编程方式移动焦点以实现可访问性的标题,这可能是一个好主意。 Such cases are for example fresh content update with AJAX in single page applications.例如,这种情况是在单页应用程序中使用 AJAX 更新新鲜内容。 The focus would be moved to a heading for a user to get aware of the content update and to be able to start from there.焦点将移至标题,以便用户了解内容更新并能够从那里开始。 Also it can be useful when currently focused content is about to get removed from the DOM (ag deleting currently focused table entry) or moving a focus to an error summary heading after a form submit trial etc.当当前关注的内容即将从 DOM 中删除(例如删除当前关注的表条目)或在表单提交试用后将焦点移动到错误摘要标题时,它也很有用。

In my case (VoiceOver on MacOS), it seems that H1 is announced as clickable only on Firefox.就我而言(MacOS 上的 VoiceOver),似乎 H1 仅在 Firefox 上被宣布为可点击。 On Chrome, it's announced correctly.在 Chrome 上,它已正确宣布。

This leads me to believe it's a Firefox bug.这让我相信这是一个 Firefox 错误。

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

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