html - SVG 的默认 ARIA 角色是什么?

标签 html svg accessibility wai-aria

如果 role 属性不存在且文档包含可见图形,我一直在尝试确定 SVG 标签的默认角色。

使用 Chrome 的辅助工具,它告诉我角色是 SVGRoot:

然而,这不是一个有效的 ARIA 角色,它是 Chrome 内部使用的自己的角色之一。

我已经能够通过此文档找到更多信息:WAI-ARIA Graphics Module ,它表示允许在 SVG 标签上使用哪些角色,但我似乎无法缩小默认角色的范围。

如果没有提供有效的 role 属性,用户代理默认假定 SVG 是什么角色?

最佳答案

根据 ARIA in HTML 文档,SVG has no default corresponding role

“无对应角色”状态定义如下:

The elements marked with No corresponding role, in the second column of the table do not have any implicit ARIA semantics, but they do have meaning and this meaning may be represented in roles, states and properties not provided by ARIA, and exposed to users of assistive technology via accessibility APIs. It is therefore recommended that web developers add a role attribute to a semantically neutral element such as a div or span, rather than overriding the semantics of the listed elements.

正如@josh 已经回答的那样,SVG 元素允许的角色是applicationdocumentimg

关于html - SVG 的默认 ARIA 角色是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49197524/

相关文章:

html - 如何通过键盘访问 `<tr>`(无 javascript)

html - 谷歌图表烛台去掉了蜡烛条以外的所有东西

javascript - 轮播 - 折叠 div 中的自动高度(Glide JS)

html - 导航上的下拉列表和元素之间的距离

html - 条件标签不起作用

javascript - d3js 径向整洁树 - dx 和 dy 是如何填充的?

html - 纯 SVG Javascript 库

menu - 使用 menuitem 角色作为链接是否正确

svg - 为什么我的 SVG 路径在 Chrome、Edge 和 Firefox 中被意外剪切?

javascript - 如何确保通过 ajax 加载的表上的逻辑选项卡顺序