可访问性:aria-haspopup 可以用来做什么? [英] Accessibility: what can aria-haspopup be used for?
问题描述
我确信aria-haspopup
适用于子菜单(例如弹出式上下文菜单或子级菜单).它用在 jQuery UI Selectmenu 上,也用在这个 <一个 href="https://stackoverflow.com/questions/12279113/recommended-wai-aria-implementation-for-navigation-bar-menu">很好的例子.
I have it on good authority that aria-haspopup
is appropriate for sub-menus (such as a popup context menu or sub-level menu). It's used on jQuery UI Selectmenu and also used in this great example.
我无法确定的是 aria-haspopup
是否适用于以下 2 个示例:
What I've not been able to find out is whether aria-haspopup
is applicable in the following 2 examples:
- 信息弹出框,例如引导程序 - 用于上下文信息,但不包含任何链接
- 弹出式浏览器窗口 - 例如与
target="_blank"
的链接
- Informational popovers such as Bootstrap's - used for contextual information, but not containing any links
- Pop-up browser windows - e.g. links with
target="_blank"
aria-haspopup
在这些情况下是否合适?如果没有,是否应该使用 ARIA 属性?
Is aria-haspopup
appropriate in those situations? If not, are there ARIA attributes that should be used instead?
推荐答案
正式它应该只用于菜单或子菜单,来自 ARIA 规范 1.0:
Officially it should be used only for menus or sub-menus, from the ARIA spec 1.0:
表示该元素具有弹出上下文菜单或子级菜单.
Indicates that the element has a popup context menu or sub-level menu.
Whatsock 风格指南在模态"部分对此进行了介绍:
The Whatsock style guide covers this under the 'modals' section:
通过向触发元素添加属性 aria-haspopup="true" 来通知屏幕阅读器用户附加了弹出窗口"似乎是个好主意,但这不是一个好主意....简而言之,除非您正在触发菜单,否则不要使用 aria-haspopup.
It might sound like a good idea to notify screen reader users that a 'Popup' is attached by adding the attribute aria-haspopup="true" to the triggering element, but this is not a good idea. ... In short, don't use aria-haspopup unless you are triggering a menu.
有一些关于扩展含义的讨论 在未来的修订中,但目前假设它用于菜单.
There is some discussion about expanding the meaning in future revisions, but for the moment assume it is for menus.
我给出了关于 Bootstrap 工具提示的答案 应该有帮助.
I gave an answer about Bootstrap's tooltips which should help.
对于弹出式浏览器窗口,无论如何都是由屏幕阅读器宣布的,不需要额外的标记.(注意:它有助于为屏幕放大镜用户包含一个新窗口的视觉指示器.)
For pop-up browser windows, those are announced by screen readers anyway, no extra markup is needed. (NB: It helps to include a visual indicator of a new window for screen magnifier users.)
这篇关于可访问性:aria-haspopup 可以用来做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!