PF/XTech/HTML5/DescriptorRequirements

From W3C Wiki
< PF‎ | XTech‎ | HTML5
Jump to: navigation, search

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

  1. null alt values MAY be provided ONLY if role="presentation"
  2. an image with an role="image" MUST be assigned a valid, meaningful, and human-parseable alt text
  3. when using IMG, role="image" SHOULD be the default value, auto-inserted or manually inserted by the author; if the author changes that value from role="image" to role="presentation", then the author must also provide a meaningful, human-parseable textual equivalent using the alt 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 the role="presentation" to the image, provided that the image is purely decorative and devoid of content; authors should also be advised that they must use role="presentation" to validate their source code. alt="" is allowed ONLY when role="presentation".
  • if role="image" is present, and no value has been defined for the alt text, that should be flagged as invalid; author should be prompted to provide a programmatically determinable textual equivalent using the alt attribute, whose value should be identical to that provided by the LEGEND element if the IMG is contained in the FIGURE element;

Conclusions So Far

  1. null alt values MAY be provided ONLY if role="presentation"
  2. an image with an role="image" MUST be assigned a valid, meaningful, and human-parseable alt text (again, we need to reinforce 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)
  3. when using IMG, role="image" SHOULD be the default value, auto-inserted or manually inserted by the author; if the author changes that value from role="image" to role="presentation", then the author must also provide a meaningful, human-parseable textual equivalent using the alt attribute

Related Resources