NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 928 - <img>s with role="presentation" and without alt="" fail validation
<img>s with role="presentation" and without alt="" fail validation
Status: RESOLVED INTENTIONAL
Product: Validator.nu
Classification: Unclassified
Component: ARIA
HEAD
All All
: P2 normal
Assigned To: Nobody
http://www.w3.org/WAI/PF/aria-practic...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-28 11:51 CEST by Ian Yang
Modified: 2012-06-28 12:44 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Yang 2012-06-28 11:51:37 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.
Comment 1 Michael[tm] Smith 2012-06-28 12:04:37 CEST
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=""...>
Comment 2 Ian Yang 2012-06-28 12:16:41 CEST
(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.
Comment 3 Michael[tm] Smith 2012-06-28 12:38:13 CEST
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
Comment 4 Ian Yang 2012-06-28 12:44:24 CEST
Thanks for the suggestion. I will try the two approaches to let them know this issue.