A mechanism for alternate content within HTML documents

Problem statement / use cases

Gaps

Terminology


Unifying the mechanisms to provide universality and accessibility – aka "A better alt"

Description of Accessibility, Internationalization and Universality Problems with ALT

<!-- USING CURRENT MARKUP -->
<span lang="fr">Lorem ipsum <abbr title="National Aeronautics and
Space Administration (Administration nationale de l'aéronautique et de
l'espace)">NASA</abbr> sit dolor amet</span>.
 

<!-- USING OG's PROPOSED MARKUP -->
<abbr title="National Aeronautics and Space Administration
(Administration nationale de l'aéronautique et de l'espace)"
titlelang="en ( fr )">NASA</abbr>
<acronym title="Working Group - groupe de travail" titlelang="en -
fr">WG</acronym>
 

Implementation Problems

Proposed solutions

A new <alt> element with a required @for=idref attribute and optional (but strongly encouraged) type=MIMEtype and @title attributes. (If multilingual equivalents are within the scope of HTML5, @lang should be also be an optional attribute.)

The content of the <alt> element is an equivalent for the "author-preferred equivalent" that the @for attribute points to. The type attribute's value provides the UA with advisory information concerning the file format of the <alt> element's content. The title attribute provides the user advisory information about the sort of content.

When an <alt> element directly follows an <img> element and does not contain an @for attribute, the UA must assume an implied @for attribute referring to that preceding <img> element.

When an <alt> element is the content of an <object>, <embed>, <audio>, <video> or <canvas> element and does not contain an @for attribute, the UA must assume an implied @for referring to that parent <object>, <embed>, <audio>, <video> or <canvas> element.

Otherwise, an <alt> element may occur anywhere within <body> provided it contains a valid @for-idref

UAs must clearly indicate occurences of <alt> elements, what they are an equivalent for, as well as the <alt> element's @title's advisory information.

UAs must provide easy access to the contents of <alt> elements.

UAs may use the @type attribute's value as the basis to by default hide <alt> elements of which the user has indicated that he does not wish them to be presented, or which the UA cannot present.

UAs should indicate the file format of <alt> elements, preferably by transliterating the MIME type to a human-readable form (applicatind/pdf == "PDF").

UAs must not hide <alt> elements by default

UAs may allow users to hide <alt> elements by default

Authors may set <alt> elements to display:none for any media, but UAs must allow users to override that both by default and on a per case basis. (Note that authors are not required to set display:none. For instance because certain equivalents may be useful side by side. Example: a transcript of an audio equivalent; a prose equivalent of tabular data; a slide show equivalent of prose; etc.)

When only one <alt> element is provided for an author-preferred equivalent, and that "author-preferred equivalent" can for whatever reason not be displayed, the UA must fallback to that equivalent.

When the author-preferred equivalent and one or more equivalents are avaiable, or when the author-preferred equivalent cannot be displayed and two or more equivalents are avalaible, the UA may fallback to an equivalent, based on pre-configured user defined settings, but must allow the user to easily override and choose another quivalent.

When the user selects a listed equivalent, the UA must load it. Either by replacing the author-preferred equivalent, or next to it, or in a separate browser window (or whatever is the equivalent in the browsing environment). Either way, the UA must provide the user with easy means to return to the previous view.

Compatibility with pre-HTML5 UAs

The contents of <alt> will be rendered by pre-HTML5 UAs. The contents of @alt and @longdesc would thus be repeating the contents of the <alt> element. This would hinder adoptance of <alt>. Therefore HTML5 deprecates @alt and @longdesc.

Example mark-up

The current wiki appears to choke on an example of the markup described above. An example of Sander's proposal, using markup, is archived in the HTML WG's list archives.

Example implementation

For an object for which there are one or more equivalents for the user to choose from, the UA could indicate this by somehow hiliting the object (in a way that is only used to indicate the availablity of equivalents). To allow the user to choose from the available equivalents, the UA could provide their @title values and the (preferably transliterated) @type value through a contextual menu. The menu could for instance contain an "equivalents" entry, with those @title and @type values listed as submenus.

Pre-Existing Alternatives to ALT

Popular UAs already provide users with mechanisms to easily detect and alternate between equivalents:

A Possible Variant

A new alt list; an <alt> element which must contain only <li> elements, each containing an equivalent, rerenced to by the author-preferred equivalent through @longdesc.

Evaluation

Pros:

Cons:


A modular solution

Alternate attributes

Some possible attributes for NMTokens and booleans to indicate whether content is displayed based on a users environment and an authors intentions:

Other attributes:

An ALT element

An ALT element whose default CSS stylesheet display property is set to none

XForms Switch/Case

Use of XForms or an HTML5 native SWITCH and CASE elements for controlling alternative display

UA Norms

Recommend interactive visual UAs provide in-place swapping of alternates based on changes to a users environment or via direct user request through a contextual menu, for example. Consider the following sample code:

<img longdesc='#sandcastle' src='sandcastle' role='photograph' >
<alt id='sandcastle' type='text/html' >The <em>whole</em> family created the biggest sand castle on the beach: big enough to move in.</alt>

In this case a UA might display the image according to the CSS styling of the document. However, if a user accessed the contextual menu for the IMG element’s frame, the UA should provide an alternates submenu with a "Long description (HTML)" item for the user to select. When selecting the item, the image is swapped out and in its place the UA renders the document fragment referenced by the long description (that document fragment is not displayed in the normal flow of the document because it is contained in an ALT element).


Discussion and evaluation

Email

WG members should post feedback and other discussion to the WG’s list serve (the URI for the links below provides date information). Search on this email subject.

Thread: Marking up links to alternative versions of content

Thread: Marking up alternative versions of content

Thread: LONGDESC: some current problems and a proposed solution added to the wiki

Thread: Multilanguage title/alt

See also

HTML/ABetterAlt (last edited 2008-06-09 14:04:16 by rburns)