"ARIA role must be appropriate for the element" 在 html/head/body

"ARIA role must be appropriate for the element" on html/head/body

虽然 运行 Chrome 开发人员中的 ax 可访问性工具,但我在 headbody 元素

上收到以下错误

ARIA role must be appropriate for the element

我的HTML如下..

<html>
<head role="banner">
...
</head
<body role="main">
...
</body>

如果我删除角色,我会收到一条错误消息,指出页面必须具有地标角色,但如果我将 main 添加回 html、head 或 body,我仍然会收到错误消息

头部和 body 与地标相关的可接受的 ARIA 角色是什么?

What are the acceptable ARIA roles for head and body that also relate to a landmark?

没有。

您的地标应该 body 元素内。

W3C provide some examples.

我想补充一下之前的回答,您可能混淆了 headheader

Banner 可能是 header 元素的适当角色。 header 本身应该出现在 body.

相反,head 元素中的信息(标题除外)不应显示在屏幕上,也不应出现在辅助功能树中。 因此他们不能发挥作用;那没有意义。