HTML landmarks are used to categorize and group content on a web page for better accessibility and SEO.
HTML5 included the addition of the following content sectioning elements, which inherit default landmark roles:
The <code>role</code> attribute is used to define an element's role on a page. When sectioning elements were introduced, the <code>role</code> attribute became used less for landmarking. This is because roles were applied by default to most sectioning elements, therefore, they were more widely used and accepted for their simplicity.
The <code>role</code> attribute is not only used for assigning roles to content sections. The attribute can also be used to assign roles to many other elements, although it is used less nowadays due to new semantic HTML elements.
The code above is the same as the following more widely accepted version:
Following the addition of sectioning elements in HTML5, there was confusion regarding whether role attributes were needed for sectioning elements. It is in fact redundant to give sectioning elements the role attribute.
Additionally, you should not try to alter sectioning elements' default roles.
The role of <code>main</code> on the <code><main></code> element is useless, as it already inherits that role as its default landmark role:Applying the <code>form</code> role to <code><header></code> is semantically improper, because it overrides <code><header></code>'s the default role of <code>banner</code>: