Role attribute obsolete in form or nav tags
Introduction
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:
Bootstrap
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.
W3C
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.
Finally
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 (eg 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
and aria-*
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
and aria-*
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.
链接地址: http://www.djcxy.com/p/36616.html上一篇: MVC 4发布不会触及控制器/操作
下一篇: 表单或导航标签中的角色属性已废弃