将 tabindex 添加到所有 DIV [英] Adding tabindex to all the DIVs

查看:48
本文介绍了将 tabindex 添加到所有 DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 DIV 和 P 元素本质上不是可聚焦的,可以通过添加 tabindex 属性使其合二为一.我正在尝试制作一个屏幕阅读器友好的网站,并想知道是否有必要在我网站上的每个 DIV 和 P 上都设置 tabindex,以便 JAWS、NVDA 和 Chrome Vox 等屏幕阅读软件可以阅读其内容.

现在使用 Chrome Vox,它不会读取段落内容,除非我有一个tabindex = 0"作为属性.我是否错误地测试了它?使用屏幕阅读软件的人是否使用其他方式阅读页面内容,然后按 Tab 键将焦点从元素转移到元素?

解决方案

只有您希望人们交互的控件(例如点击或输入)应该是可聚焦的.

您不应该仅仅为了让它们被阅读而使它们可聚焦(而且我测试过的任何屏幕阅读器(不包括 Vox)都不需要它).

让它们成为焦点会使人们更难使用该网站,因为他们必须通过标签浏览更多元素才能找到他们想要与之交互的元素.

<小时>

来自 Chrome Vox 文档:

<块引用>

要浏览屏幕上的文本,您可以使用 ChromeVox 修饰键.在 ChromeBook 上,ChromeVox 键是 Shift 和 Search,在 Mac OS X 上,ChromeVox 键是 Control 和 Command,而在其他平台(如 Windows)上,ChromeVox 键是 Control 和 Alt.要浏览页面,请按向上和向下箭头键旁边的 ChromeVox 键来浏览页面.

I know DIVs and P elements are not inherently focusable and can be made to be one by adding tabindex attribute. I am trying to make a Screen Reader friendly website and was wondering if it is necessary to have tabindex on each and every DIVs and P on my site so that the screen reading software like JAWS, NVDA and Chrome Vox can read its content.

Right now using Chrome Vox, it does not read a Paragraph content unless I have a "tabindex = 0" as an attribute. Am I testing it incorrectly? Do people who use screen reading software use some other way to read the page content then hitting tab to shift focus from element to element?

解决方案

Only controls you want people to interact with (e.g. click or type into) should be focusable.

You should not need to make them focusable just to allow them to be read (and no screen reader I've ever tested (which doesn't include Vox) has required it).

Making them focusable would make it harder for people to use the site since they would have to tab through more elements to get the ones they want to interact with.


From the Chrome Vox documentation:

To navigate through the text on a screen, you can use the ChromeVox modifier keys. On a ChromeBook, the ChromeVox keys are Shift and Search, on Mac OS X the ChromeVox keys are Control and Command and on other platforms, such as Windows, the ChromeVox keys are Control and Alt. To move through a page, press the ChromeVox keys alongside the Up and Down arrow keys to navigate through the page.

这篇关于将 tabindex 添加到所有 DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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