PF/XTech/HTML5/DescriptorRequirements
Providing Human-Parseable and Machine-Processible Terse Textual Alternatives and Markers for Static Images
NOTE: This document became obsolete on 4 March 2009; please consult the 4 March collaborative edits to the most current proposal
Recommended Usage
- null
alt
values MAY be provided ONLY ifrole="presentation"
- an image with an
role="image"
MUST be assigned a valid, meaningful, and human-parseablealt
text - when using
IMG
,role="image"
SHOULD be the default value, auto-inserted or manually inserted by the author; if the author changes that value fromrole="image"
torole="presentation"
, then the author must also provide a meaningful, human-parseable textual equivalent using thealt
attribute for the source code to validate.
Note: We need to state normatively that alt
text and the contents of the LEGEND
child element, if FIGURE
is used, should be identical, with the exception that the LEGEND
text can be "rich" (contain markup); likewise, it is important to emphasize
Authoring Scenarios
Note: The code examples provided below are examples of code as might be output by an author or authoring tool or aggregator, such as Flickr.
Case 1: Image Needs alt, Author Provides It
Author's Source Code:
<img src="123.jpg" alt="Photo of my granny">
Commentary:
The act of populating the value for alt should trigger the insertion of role="image"
, unless the use case is a composite image, in which case the composite should be contained in a DIV
marked with role="image"
, the alt
text defined for the composite image MAY be contained in the first of the composite images, allowing the author to use alt=""
on all of the other pieces of the composite image, provided that the first image contained in the composite describes the composite image fully. Authors SHOULD not break up the alt
text if delivering an image in pieces -- attach it to the first piece of the composite.
Case 2: Author Specifies the Image Should be Ignored
Author's Source Code:
<img src="123.jpg" role="presentation" alt="">
Case 3: Image Needs alt, Author Can't/Won't Provide It, Also Doesn't Care If Code is Valid
Author's Source Code:
<img src="123.jpg">
Commentary:
If the author uses <img src="123.jpg">
, the authoring tool or rendering engine should detect the missing alt attribute and insert a type="invalid"
or type="incomplete"
or, more practically, the role="image"
to denote that this is visual content which MUST have a textual alternative provided for it
Case 4: Image needs alt, author can't/won't provide it, but does want code to be valid
Author's Source Code:
<img src="123.jpg" alt="">
Commentary:
Without the role="presentation"
this case should be flagged as a failure/error -- the author hasn't provided the requisite information that declaratively marks the image as presentational, so the empty value for alt
should be flagged as an error, with the fix being:
- if
role="presentation"
is not present, this is invalid markup; validation engines should report this as an error and advise the author to use therole="presentation"
to the image, provided that the image is purely decorative and devoid of content; authors should also be advised that they must userole="presentation"
to validate their source code.alt=""
is allowed ONLY whenrole="presentation"
. - if
role="image"
is present, and no value has been defined for thealt
text, that should be flagged as invalid; author should be prompted to provide a programmatically determinable textual equivalent using thealt
attribute, whose value should be identical to that provided by theLEGEND
element if theIMG
is contained in theFIGURE
element;
Conclusions So Far
- null
alt
values MAY be provided ONLY ifrole="presentation"
- an image with an
role="image"
MUST be assigned a valid, meaningful, and human-parseablealt
text (again, we need to reinforce thatalt
text and the contents of theLEGEND
child element, ifFIGURE
is used should be identical, with the exception that theLEGEND
text can be "rich" (contain markup) - when using
IMG
,role="image"
SHOULD be the default value, auto-inserted or manually inserted by the author; if the author changes that value fromrole="image"
torole="presentation"
, then the author must also provide a meaningful, human-parseable textual equivalent using thealt
attribute
Related Resources
- Alternate Proposal from GreggV
- Proposal| GreggV+GJR]
- A role Attribute for HTML5
- A Unified Approach to HTML5's Media Specific Elements