Skip to main content

HTML Guide

The “dialog” role is unnecessary for element “dialog”.

The role="dialog" attribute is redundant when used on a <dialog> element because <dialog> has an implicit dialog role by default.

According to the WHATWG HTML living standard and ARIA in HTML, the <dialog> element already has the appropriate semantics for assistive technologies, so explicitly adding role="dialog" is unnecessary and causes warnings in validators.

Incorrect usage:

<dialog role="dialog">
  This is a dialog box.
</dialog>

Correct usage:

<dialog>
  This is a dialog box.
</dialog>

Simply remove the role attribute from the <dialog> element to resolve the warning.

Learn more:

Related W3C validator issues