HTML 元素如 pill/badge 需要额外的 Aria 角色吗?

Do HTML elements like pill/badge need extra Aria-role?

我正在尝试为我的网页添加辅助功能,但我不确定如何处理这个徽章元素。它类似于您在在线购物车图标上看到的数字圈。 (见下图示例)

我无法决定我应该给它分配什么样的 aria 角色。或者我什至需要特别为它分配一个 aria 角色吗?很确定它不是“role=button”,因为这里没有点击事件。

我通过添加一个 aria-label 来处理这种情况,其中包含对数值的更具描述性的解释。至于 role,我会选择 statusThe example W3 的站点实际上以购物车为例。

<span role="status" aria-label="14 items in your shopping cart">14</span>

我喜欢 statusalert 角色之间的区别。

The status role is a type of live region and a container whose content is advisory information for the user that is not important enough to justify an alert.

更多相关信息 here