Bugzilla – Bug 928
<img>s with role="presentation" and without alt="" fail validation
Last modified: 2012-06-28 12:44:24 CEST
On the Presentation Role section of W3C ARIA Authoring Practices ( http://www.w3.org/WAI/PF/aria-practices/#presentation_role ), it is stated that <img>s can be validly without alt="" when they have role="presentation". However, validator.nu currently thinks that is invalid.
The validator conforms to the requirements in the HTML spec, and the HTML spec requires an img element to have an alt attribute even if it has a role=presentation attribute. So either do <img role=presentation alt=""...> or drop the role=presentation altogether and just do <img alt=""...>
(In reply to comment #1) > The validator conforms to the requirements in the HTML spec, and the HTML spec > requires an img element to have an alt attribute even if it has a > role=presentation attribute. So either do <img role=presentation alt=""...> or > drop the role=presentation altogether and just do <img alt=""...> Thanks. But HTML spec was defined exactly by W3C, wasn't it? W3C used to think that a decorative img element must have an empty alt attribute. Now as the new ARIA suite comes out, W3C thinks using role="presentation" is more appropriate than using an empty alt attribute.
Like I said, the validator conforms to the requirements in the HTML spec. Whatever problem there is here, it's not a problem with the validator. The http://www.w3.org/WAI/PF/aria-practices/ document is, as far as I can see, a non-normative guide that doesn't state any actual requirements. The normative document-conformance requirements for the img element are defined in the HTML spec, and that currently says the alt attribute is required even for the role=presentation case. So the http://www.w3.org/WAI/PF/aria-practices/ document has a bug in that the statement 'the preferred way to mark <img> elements as decorative is to use a role="presentation" attribute instead of (or in addition to) an empty alt attribute' conflicts with the current requirements in the HTML spec, and the alt-less examples at http://www.w3.org/WAI/PF/aria-practices/#presentation_role are not actually valid. So I suggest you either send a message to public-pfwg-comments@w3.org to report that problem with that document, or if you think the alt attribute should not be required for the role=presentation case, file a bug against the HTML spec at http://w3.org/brief/MjA2
Thanks for the suggestion. I will try the two approaches to let them know this issue.