Skip to main content
HTML Validation

Bad value “section” for attribute “role” on element “section”.

About This HTML Issue

Using role="section" on a <section> element is unnecessary and not recommended.

The <section> element is a semantic HTML5 element that is used to define sections within a document. A <section> inherently carries the semantics of a structural region, so you don’t need to explicitly declare a role attribute for it. The role attribute in HTML is mainly used to enhance accessibility by explicitly defining the purpose of an element when the element’s native HTML semantics are missing or insufficient. However, in this case, since <section> is already semantically meaningful, assigning a role="section" results in redundancy and can cause validation warnings or errors.

HTML5 and ARIA (Accessible Rich Internet Applications) guidelines suggest only using roles when absolutely necessary. Misusing roles can lead to confusion for assistive technologies, potentially impacting user accessibility.

Here’s a correct use of the <section> element without the role attribute:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Document Title</title>
</head>
<body>
  <header>
    <h1>Website Header</h1>
  </header>
  
  <section>
    <h2>Section Heading</h2>
    <p>This is a paragraph within the section.</p>
  </section>
  
  <footer>
    <p>Website Footer</p>
  </footer>
</body>
</html>

By removing role="section", you leverage the semantic meaning that the <section> element already provides, ensuring cleaner, more accessible, and standards-compliant HTML.

Last reviewed: April 04, 2025

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.