Skip to main content

HTML Guide

Bad value “sidebar” for attribute “role” on element “div”.

sidebar is not a valid value for the role attribute according to the ARIA (Accessible Rich Internet Applications) specification.

The role attribute is used to define the purpose of an element for assistive technologies. Only certain predefined values are valid, such as navigation, complementary, main, banner, contentinfo, and others. There is no sidebar role in the ARIA or HTML specification. If you wish to indicate a sidebar, you should use the complementary role, which is intended for content that is tangentially related to the main content, such as a sidebar.

Incorrect Example:

<div role="sidebar">
<!-- Sidebar content -->

</div>

Correct Example:

<div role="complementary">
<!-- Sidebar content -->

</div>

Alternatively, you can use the aside element, which conveys the same meaning and does not require an explicit role attribute:

<aside>
<!-- Sidebar content -->

</aside>

Using either the role="complementary" on a generic container or the semantic <aside> element ensures your HTML is valid and accessible.

Learn more:

Related W3C validator issues