Validity map for <img> (Poll A, ISSUE-31, ISSUE-80, validation)

This letter is a reference for my (not yet finished) reply in the poll 
[1][2] about how @role=presentation, @title, @aria-labelledby (as well 
as @aria-describedby and @aria-label) impact on the validity of an 
<img> element. 

Validity map: 

Hereby is offered a role based validity map, tested in ARIA supporting 
AT, which also takes into account that presentational images should not 
"show up" with author supplied or UA supplied fallback repair when/if 
images for some reason isn't displayed or enabled. (Thus validity of 
<img> should not only be about accessibility.) Non-empty @alt is taken 
literally: whitespace count as @alt, as specced by HTML5. In case of 
whitespace in @alt, AT will look for alternate text in @title or in 
@aria-* (according to my tests in VoiceOver).

* General:
  1. some attributes asked about in the poll impact the <img>'s
     role, which in turn sets validity requirements. 
  2. A basic requirement should be that @alt reflects the role:
      - role=presentation implies empty @alt, 
      - role=img implies non-empty @alt 
      - only if nothing else sets the role does @alt itself set it
     NOTE: VoiceOver works like that: It doesn't ignore <img> with
           empty alt in combination with non-empty @title. Such an
           image is also not considered presentational by sighted.
     NOTE: white-space according to HTML5 equals a non-empty @alt.
  3. an <img> which defaults to img role because nothing else
     implicitly or explicitly sets the role, is invalid:
      - with no-alt, the element defaults to img role, as long 
        as nothing else explicitly or implicitly sets its role.

* How role should be applied - overview. Value implies weight.
  2. Explicit role declaration
  1. Implicit role declaration
  0. Defaulting to role img (invalid)

* How role should be applied - in detail. Value implies weight.
  2. Explicit role declaration (always takes precedence)
     * presentation (role) is considered explicitly declared
       a. if parent has role:childrenArePresentational (ARIA 1.0)
       b. when <img> has @role=presentation
     * img (role) is explicitly declared 
       c. if <img> has @role=img and 2a isn't the case either;
  1. Implicit role declaration (in lack of explicit role)
     * img (role) is implied by the presence of:
       a. a non-empty @alt
       b. a non-empty @title
       c. a @longdesc of any value (depends on ISSUE-30)
       d. a non-empty aria-labelledby/aria-describedby/aria-label
       e. <img> + <figcaption>, as the only children of <figure>
       f. <img> as only child of semantic element:<a><dfn><h1> etc
       NOTE: For 1b to 1f, validator must ask for non-empty @alt.
     * presentation (role) is implied
       g. if @alt is empty and 1b,1c,1d,1e is not the case
  0. img role as result of default is invalid
     img role as result of default has these characteristics:
       * no explicit @role (2a,2b,2c)
       * no implicit role (1a,1b,1c,1d,1e,1f,1g)
       NOTE: adding @alt or @role or non-empty @title/@labelledby
             @describedby/@label gives the element an implicit or
             explicit role, whose validation rules then apply.

     NOTE: empty @title, @aria-labelledby, @aria-describedby
           or @aria-labelledby imply nothing and does thus
           not affect any role in any way.

* General validation rule:

  - When validator detects an explicit or implicit role, it must
    if needed, ask author for a corresponding @alt. EXAMPLES: 
    if @title is non-empty, there must be a non-empty alt. Or in
    case of explicit role="presentation", alt must be empty.
  - When validator detects an img role default, then it must ask
    author to add @alt (or give options/guidance what to do).

* Specific validation rules:

  # presentation (role), explicit or implicit:
    * empty @alt is required
    * a non-empty title would be invalid
    * any @longdesc (ISSUE-30) would be invalid
    NOTE, for explicit role=presentation:
      - @labelledby/@describedby/@label (any value) get disabled
        and thus does not need to be removed.
    NOTE for implicit presentation role:
      - implicit presentation cannot really be validated since any
        non-empty alt/title/labelledby/describedby/label/longdesc
        would change its role from presentation to img (tested
        in VoiceOver).
   
  # img (role) explicit or implicit:
    * non-empty alt is required
    * any value of title is valid
    * any value of -labelledby/-describedby/-label is valid

  # img role as result of default is always invalid
    * specialities, img role as result of default:
      - it has no @alt
      - labelledby/-describedby/-label/title if present, is empty

   Caveat: it really is up to ARIA whether empty -labelledby,
           -describedb or -label causes the element to be treated
           as having role img. But it seems logical that it has no
           impact. And VoiceOver seems to work that way.

[1] 
http://www.w3.org/2002/09/wbs/40318/issue-31-80-validation-objection-poll/?
[2] 
http://www.w3.org/2002/09/wbs/40318/issue-31-80-validation-objection-poll/results
-- 
Leif Halvard Silli

Received on Thursday, 31 March 2011 02:13:19 UTC