Mike
Mike

Reputation: 2559

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

Whilst running the aXe accessibility tool in Chrome Developer, I am getting the following error on my head and body elements

ARIA role must be appropriate for the element

My HTML is as follows..

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

If I remove the roles, I get an error saying a page must have a landmark role but if I add main back to either html, head or body, I still get the error

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

Upvotes: 0

Views: 1931

Answers (2)

QuentinC
QuentinC

Reputation: 14872

I would like to add to the previous answer that you have probably made a confusion between head and header.

Banner is a possible appropriate role for an header element. The header should itself be present inside the body.

In the opposite, informations in the head element (except title) aren't supposed to be shown on screen and be present in the accessibility tree. Thus they musn't have a role; that wouldn't make sense.

Upvotes: 1

Quentin
Quentin

Reputation: 944439

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

There aren't any.

Your landmarks should be inside the body element.

The W3C provide some examples.

Upvotes: 2

Related Questions