Warning:
This wiki has been archived and is now read-only.

ChangeProposals/ImgElement20100504

From HTML WG Wiki
Jump to: navigation, search

Require alt. Correct Definition to Provide Equality. Replace Guidance for Conformance Checkers.

Editors: Laura Carlson (laura.lee.carlson@gmail.com)

Date: May 04, 2010. (Last Updated Novembet 28, 2010)

For HTML ISSUE-31: missing-alt

Summary

This HTML5 change proposal modifies the image element. It replaces the:

  1. Guidance for Conformance Checkers [1] with guidance that requires any image that lacks an alt attribute to be flagged as an error in the validator and the page declared invalid.
  2. Definition of the img element [2] with language that makes alt and src attributes equivalent.

This change proposal helps resolve HTML ISSUE-31: missing-alt [3].

Rationale

Simpler is Better

The alt attribute is the most successful accessibility attribute in any version of HTML. This is largely do to the simple message conveyed to authors: "All images require an alt attribute".

Conditional rules (if this, then that, but not when...) introduces complexity which would make:

  • Learning how to write good text alternatives more complicated for authors.
  • Teaching how to write good text alternatives more complicated for educators.
  • Designing user-friendly ATAG compliant tools more complicated for tool makers.

Adding loopholes and/or more techniques for text alternatives is a complexity which may result in confused and lost authors. The more choices you give people, the harder it is for them to choose, and the more likelihood of them getting it wrong.

It will be difficult and costly for tools to implement the additional steps.

The best way to increase good text alternative usage is through simplicity and consistency: require alt.

Structural Integrity of the Language

Requiring alt helps ensure that images have complete structure. Complete structure requires both visual and textual content.

src is to sighted users as text alternatives is to some users with disabilities.

  • Omit the src attribute and sighted users have no content.
  • Omit text alternatives and some users with disabilities have no content.

Without both a src and a text alternative the <img> element is incomplete.

Upholding Standards and the Authoring Tool Quandary

Lowering standards to move away from a situation that explicitly requires the language of the web to be non-discriminatory, to one where the language of the web allows discrimination to be valid would be a step backward. Content in the src and alt attributes are of equal importance.

The web is the medium, HTML a language, and tools are tools. Because some developers or tool makers may not be willing to fully use the potential of the language and some tools may not be up to the task does not justify debasing the web's inclusive world-wide goals.

As a markup language, HTML5 should be concerned with upholding standards, rather than lowering integrity constraints to cater for poor tools, authors, or both.

The spec currently states: "Authoring tools and markup generators must generate conforming documents." [4]

This is a flawed rule as far as text alternatives are concerned. As Gez Lemon has stated [5],

When an authoring tool doesn't have anything useful to put in for the alt text, the tool shouldn't put anything in. A good authoring tool will check for missing alt text and offer to assist the user in repairing the content. If an author is adamant they're not going to provide alt text, there is no requirement that says the authoring tool should provide it in place of the author. In fact, it's just the opposite, as the authoring tool could not possibly know the author's intent. In this scenario, the authoring tool should not include the alt attribute at all, and the resulting markup should be considered invalid. It should be considered invalid because it is inaccessible, and not perceivable by some people. If the tool allows alt text to be provided, then the tool would be considered compliant (on this particular issue), even though the resulting markup would not be compliant, as the user chose not to make the content compliant.

Accessibility Awareness

Enabling automatic validators to programmatically detect the presence or absence of text alternatives (as HTML4 did with alt) raises public awareness of Web accessibility in general. It is an undeniable advertisement that text alternatives are needed and a chance to educate the author about proper usage. More people use the W3C validator than read the specs. It has been said that the W3C HTML4 validator has done worlds more than the HTML4 specification for increasing the quality of HTML documents on the web [6].

Education - A Teachable Moment

Requiring the alt attribute aids in accessibility education [7]. In other words, validators create a teachable moment. Indeed, the W3C validator is currently used for university classes as a valuable teaching and learning tool. For example, a first lesson in teaching good authoring practice is to have developers and students validate HTML on the W3C site to be sure that it is error-free and that they have indeed examined each image. It makes a big impression that text alternatives are mandatory not just for WCAG but for valid HTML as well. When accessibility is an integrated part of authoring good HTML, the outcome is more perceivable content.

People fix errors. Directly pointing authors who encounter a missing text alternative error to advice on how to fix it will offer an especially powerful learning method exactly when it is needed called Just-in-Time Training (JITT). Mike Smith is working on a pilot validator implementation for missing text alternative error reporting. As the accessibility task force recommendation stated, the "error text is expected to reference additional guidance on text alternatives in WCAG support materials".

PFWG WAI Review of the alt Attribute

The Web Accessibility Initiative's Protocols and Formats Working Group (WAI PFWG) reviewed the alt attribute issue [8] in 2008 and concluded,

Conclusion: barring the introduction of new, good reasons for a change, the failure of the HTML5 draft to make @alt on <img> an across-the-board requirement (even if sometimes it has the value of "") is a bug.

Additional Rationale

Correcting the Definition to Provide Equality

Content in the src and alt attributes are of equal importance. Vlad Alexander has pointed out the inequity of the current HTML5 img element definition in his article, Should HTML5 spec correct the img element definition? [9]

The HTML5 spec defines the <img> element as an element that "represents an image". The spec then defines alternative text (textual content) as "fallback content". What's wrong with this? These definitions suggest that the visual content (the image) is more important than the textual content. As a result, to many people, if the primary purpose of embedding an image is achieved, the secondary or fallback purpose (textual content) can be skipped or given cursory effort.

The principle behind this definition is already in practice in a publicly available HTML reference...

The <img> element's visual content and its textual content are equivalent in meaning and should therefore be of equal importance. How elements are defined in the specification influences tool vendors, educators and ultimately Web site creators, so that clearly defining the correct use of HTML elements can over time improve the use of HTML.

Details

Replace the Definition of the Image Element:

An img element represents an image.

The image given by the src attribute is the embedded content, and the value of the alt attribute is the img element's fallback content.

With Suggested Definition of the Image Element:

The <img> element represents content that can be rendered visually (as an image) and textually. The src attribute provides visual content in the form of an image and the alt attribute provides textual content. The content in the src and alt attributes must convey equivalent meaning.

Source: Vlad Alexander

Replace the Current Guidance for Conformance Checkers Text:

A conformance checker must report the lack of an alt attribute as an error unless one of the conditions listed below applies:

  • The title attribute is present and has a non-empty value (as described above).
  • The img element is in a figure element that contains a figcaption element that contains content other than inter-element whitespace (as described above).
  • The conformance checker has been configured to assume that the document is an e-mail or document intended for a specific person who is known to be able to view images.
  • The document has a meta element with a name attribute whose value is an ASCII case-insensitive match for the string "generator". (This case does not represent a case where the document is conforming, only that the generator could not determine appropriate alternative text — validators are required to not show an error in this case to discourage markup generators from including bogus alternative text purely in an attempt to silence validators.)

With Suggested Guidance for Conformance Checkers Text:

A conformance checker must report the lack of an alt attribute on the <img> element as an error.

Impact

  • Corrects the definition to provide equality. Bug 9098
  • Declares resulting structure invalid, if an alt attribute is not detected.
  • Upholds the structural integrity of the markup language.
  • Raises accessibility awareness.
  • Aids accessibility education.
  • Reduces complexity.
  • Enables automatic validators to easily programmatically detect occurrences of the presence or absence alt.
  • Corrects the spec to disallow <img> to be valid with the email exception Bug 8646.
  • Corrects the spec to disallow <img> to be valid with the title attribute.Bug 7362. Also Bug 9215 (WebCam), Bug 9216 (CAPTCHA).
  • Corrects the spec to disallow <img> to be valid with the generator mechanism. Bug 9212

References

Related References

Detailed Three Year History of the Issue

A detailed three year history of the issue includes issue description, time line, proposed solutions, rationale - pros and cons, research, advice from WAI, use cases, policies/guidelines/law, and email threads:

Related Bugs