I know, the role attribute was introduced by W3C in WAI-ARIA 1.0 and was then adapted in HTML5.
When HTML5 was new and many browser didn't implement the native elements people advised to back them up with the role attribute like <nav role="nav">…</nav>
, but they also mentioned that this will become unnecessary soon.
But at the moment, there are different opinions:
A bootstrap member stated on GitHub that the WAI-ARIA rules are "more important" then the current HTML5 specifications. Also, other third-party sites like TutorialsPoint or W3Schools also recommend to add the attribute to grant full accessibility.
On the other side, the W3C-Validator gives the following warning when you input the questionable form tag with a role attribute.
<form role="form"></form>
Element form does not need a role attribute.
This would clearly speak for not including the role attribute.
Has the time already come to neglect backing up the native HTML5 tags (and forms), or is it still necessary to guarantee a fully accesible website (e.g. for handicapped people/people with screen readers)? Is there a kind of "official statement" or a guideline (which is up-to-date)?
Maintainer of the W3C HTML Checker (validator) here. The short answer is that the current authoritative requirement that’s relevant to the <form role="form"></form>
case is this:
Web developers should not set the ARIA
role
andaria-*
attributes to values that match the default implicit ARIA semantics defined in the table.
…where “the table” means the table in the Document conformance requirements for use of ARIA attributes in HTML section of the ARIA in HTML spec, the latest version of which you can find here:
http://w3c.github.io/html-aria/
And the reason that spec is authoritative is because the HTML spec itself formally references it:
Conformance checker requirements for checking use of ARIA
role
andaria-*
attributes on HTML elements are defined in ARIA in HTML.
The W3C checker therefore strictly follows the rules in ARIA in HTML. So, given the following:
<form role="form"></form>
is a case of setting a role
value for the form
element that matches the default implicit semantics of the form
element, and;role
value should not be set to a value that matches the default implicit semantics of the element…the checker therefore gives that Element form does not need a role attribute warning.
Is there a kind of "official statement" or a guideline (which is up-to-date)?
Yes, that’s exactly what the ARIA in HTML spec is.
Any source conflicting with ARIA in HTML spec rules is wrong or outdated and should be corrected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With