IITAA Rule 32: ALT text must describe content or purpose of image

Rule Mapping

Details

  • For images that don’t have a presentation role and that can be determined to be non-decorative, determine if the alt attribute is descriptive.
  • Non-decorative images that convey meaning must have meaningful alt text.

Markup References

Validation Code

Dependencies

None

Context

img[@role != "presentation"]

Parameters

None

Code

function (ruleContext) {
  // Fail if an img element does not have ALT attributes
  // If image does have an ALT attribute the tester should verify that it is meaningful
  var passed = OpenAjax.a11y.xbrowser.hasAttribute(ruleContext, "alt");
  return new ValidationResult(passed, [ruleContext], '', '', []);
} // endfunction