Requirements to expose links to users and accessibility APIs are now MUST when the URI is valid. Bugs 21566, 21564, 21778, (provisionally) resolved at TF meeting 2013-04-02
authorcharles
Thu, 02 May 2013 21:27:00 +0200
changeset 34 36fc9d2d661e
parent 33 720b89aac76f
child 35 cd9b3e23eea4
Requirements to expose links to users and accessibility APIs are now MUST when the URI is valid. Bugs 21566, 21564, 21778, (provisionally) resolved at TF meeting 2013-04-02
longdesc1/longdesc.html
--- a/longdesc1/longdesc.html	Sat Apr 20 11:24:38 2013 +0200
+++ b/longdesc1/longdesc.html	Thu May 02 21:27:00 2013 +0200
@@ -21,9 +21,7 @@
           used in this specification are defined in<cite><a class="bibref" href="#bib-DOM4"></a></cite>
          [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>]<cite><a class="bibref"
              href="#bib-XML10"></a></cite>.</p>
        <p>This document does not define the term "accessible" nor
          accessibility, but uses them with the sense they have in [<a href="file:///Users/chaals/Documents/w3c/html-proposals/longdesc1/longdesc.html#bib-WCAG">WCAG</a>]</p>
      </section>
    </section>
    <section id="UCnR">
      <h2><span class="secno">2. </span>Use Cases and Requirements</h2>
      <p>There are many ways users can successfully interact with content even
        if they cannot see, or see well, images included in that content. The <code>alt</code>
        attribute is designed to ensure that for everyday work, a user has
        enough information to replace an image, and often this is more helpful
        than a detailed description of every image. The <code>longdesc</code>
        attribute is designed to complement this functionality, to meet the
        following use cases.<br>
      </p>
      <h3>Use Cases</h3>
      <dl>
        <dt>Identifying a well-known image</dt>
      </dl>
      <dl>
        <dd>There are many well-known images which are widely reproduced and
          well known. In some cases, such as "Mona Lisa", "GernĂ­ka", Cubbin's
          "Lost", Leunig's "ramming the shears", the most effective way to refer
          identify an image to another person is by the creator, title, and
          similar information that would be found in a catalogue. But different
          people know the images by different titles, and some images have no
          widely known titles. Identifying an image is often an important part
          of framing a discussion. Where the image itself cannot be seen, a
          description can often be used to offer easier recognition than the
          cataloguing information, for example "Washington crossing some river,
          standing heroically in the boat, while soldiers do the hard work", or
          "the Da Vinci picture of the guy in a square and a circle".</dd>
        <dd><em>Requires</em>: Discoverability</dd>
        <dd><em>Helped by</em>: Inline, Reuse</dd>
        <dt>Describing a complex diagram</dt>
        <dd>In many environments diagrams are used to explain a concept or
          transmit information efficiently. Where a user has a reduced ability
          to see the image (poor contrast vision and other conditions are as
          relevant here as a complete lack of vision), a description can enable
          that user to understand the information being presented</dd>
        <dd><em>Requires</em>: Structured Markup, Inline, Reuse, Simple Return</dd>
        <dt>Teaching Accessible Development</dt>
        <dd>In many environments producing content that is accessible to users
          regardless of disability is a legal and/or market requirement. </dd>
        <dd><em>Requires</em>: Maintenance, Backwards compatibility</dd>
        <dt>A self-describing artistic work</dt>
        <dd>For many pages the visual design of the page is an important part of
          the message it conveys to a fully-sighted user, but the author would
          like to convey as much of that design as possible to a user with low
          or no vision available. </dd>
        <dd><em>Requires</em>: No visual encumbrance, Structured Markup</dd>
        <dd><em>Helped by</em>: Reuse, Simple Return</dd>
        <dt>Referring to an existing description</dt>
        <dd>Many well-known images are already described by other sources. The
          copyright on those sources may not be compatible with re-publishing
          the description, but there is little value in making a new one. </dd>
        <dd><em>Requires</em>: Reuse, Structured Markup, Simple Return, Optional
          Consumption<br>
        </dd>
        <dd><em>Helped by</em>: No Visual Encumbrance</dd>
        <dt>Linking to a description included within a page</dt>
        <dd>In some cases an image already has a description included within a
          page. Making the linkage explicit can provide further clarity for a
          user navigating the page who is not able to interpret the default
          layout, e.g. because they have forced a re-layout of the page
          elements, or because they do not see the default visual relationship
          between the element and its description.</dd>
        <dd>This practice also enables description to be provided for all users.</dd>
        <dd>By keeping the association clear the content maintainer can more
          easily check that the description and link are actually correct.</dd>
        <dd><em>Requires</em>: Inline, Simple Return, Structured Markup,
          Optional Consumption<br>
        </dd>
      </dl>
      <h3>Requirements for an Image Description functionality </h3>
      <dl>
        <dt>No visual encumbrance</dt>
        <dd>It <em class="rfc2119">must</em> be possible to provide a
          description for an image without any visual encumbrance on the page.</dd>
        <dt>Structured Markup</dt>
        <dd>It <em class="rfc2119">must</em> be possible to include rich markup
          (e.g. HTML5) in the description of the image.</dd>
        <dt>Inline</dt>
        <dd>It <em class="rfc2119">must</em> be possible to associate a
          description in the body of a page with an image in that page. </dd>
        <dt>Reuse</dt>
        <dd>It <em class="rfc2119">must</em> be possible to re-use a single
          description for multiple occurrences of an image.</dd>
        <dt>Maintenance</dt>
        <dd>It <em class="rfc2119">must</em> be simple to maintain a library of
          images and descriptions for dynamic assembly, or dis-assembly and
          re-assembly, of content. </dd>
        <dt>Discoverability </dt>
        <dd class="rfc2119">It <em class="rfc2119">must</em> be simple for a
          user agent to automatically discover a description provided for a
          given image.</dd>
        <dd>A user <em class="rfc2119">should</em> be able to determine that
          there is a description available for a given image.<br>
        </dd>
        <dt>Optional consumption</dt>
        <dd>A user <em class="rfc2119">must</em> be able to choose not to read
          the long description of a given image.</dd>
        <dt>Simple return</dt>
        <dd>A user <em class="rfc2119">must</em> be able to return from the
          description to the image. </dd>
        <dt>Backwards Compatibility </dt>
        <dd>It <em class="rfc2119">should</em> be possible to use existing
          tools and techniques to associate an image with its description. </dd>
      </dl>
    </section>
    <section id="longdesc">
      <h2><span class="secno"></span>3. The <code>longdesc</code> attribute</h2>
      <h3>3.0 Implementation</h3>
      <h4>3.0.1 Authors and Conformance checkers</h4>
      <section id="parsing">
        <p class="rfc2119">Zero or one <code>longdesc</code> attributes <em class="rfc2119">may</em>
          be added to any <code>img</code> element.</p>
        <p>The <code>longdesc</code> attribute <em class="rfc2119">must</em>
          contain a <a href="http://dev.w3.org/html5/spec/urls.html#valid-url-potentially-surrounded-by-spaces">valid
             non-empty URL potentially surrounded by spaces</a>. The URL is a <a
            href="http://dev.w3.org/html5/spec/links.html#hyperlink">hyperlink</a>
          to a description of the image that its parent <code>img</code>
          element represents. </p>
        <p>The linked description <em class="rfc2119">should</em> be a broadly
          accessible format. (For example, a link to another version of the
          image is almost certainly not a useful description, and plain text is
          an extremely limiting format).</p>
        <div class="note">
          <p><em>This section is informative</em></p>
          <p>Best practices for checking descriptions of images are beyond the
            scope of this document, but there are many resources available.
            For&nbsp; further guidance tool developers can consult e.g. [<a href="#bib-ATAGB3">ATAGB3</a>].
             <span class="issue">ISSUE: This doesn't seem a great reference - is
              there anything better? This is tracked in <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=21501">bug
-                21501</a> and its dependent bugs.</span></p>
        </div>
        <h4>3.0.2 Authors</h4>
        <p>Authors <em class="rfc2119">should</em> put descriptions within an
          element which is the target of a fragment link (e.g. <code>longdesc="example.html#description"</code>)
          if a description is only part of the target document. </p>
        <div class="note">
          <p><em>This section is informative</em></p>
          <p>Best practices for full descriptions of images are beyond the scope
            of this document, but there are many resources available.</p>
          <p>This document does not define the term "accessible" nor
            accessibility. For further guidance on making an accessible
            document, authors can consult e.g. [<a href="#bib-WCAG2">WCAG</a>].</p>
        </div>
        <h4>3.0.3 User Agents</h4>
        <p>User agents <em class="rfc2119">must</em> make the link available to
          all users through the regular user interface(s). <span class="issue">ISSUE:
-            There are some cases where this may not make sense. Is it better for
            the requirement to include explicit exceptions, or to keep it a
            should. This is tracked in <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=21566">bug
-              21566</a> and its dependent bugs.</span> </p>
        <p>User agents <em class="rfc2119">should</em> expose the link to
          relevant APIs, especially accessibility-oriented APIs.<br>
        </p>
        <p>User agents <em class="rfc2119">should</em> enable users to discover
          when images in a page contain a long description.</p>
        <div class="note">
          <p><em>This section is informative</em></p>
          <p>Complete documentation of best practices for implementation is
            beyond the scope of this document. However the following notes are
            offered to help repair a common authoring mistake and avoid a common
            user agent mistake.</p>
          <p>One of the most common mistakes authors make that is easily
            repaired by user agents is to use a description, instead of a URL
            that links to a description. This means there is often plain text
            description in the content of an invalid longdesc attribute.
            Converting such attributes to data URLs is a simple repair strategy
            that can help recover from cases where authors have made this
            mistake. </p>
          <p>Since some images with long description are also normal link
            content, it is important for implementations to ensure that users
            can activate both behaviours. Likewise, it is generally helpful when
            the behaviour for finding, reading, and returning from a long
            description to the image described is a consistent experience.</p>
          <p>Obviously, it is important that access to the long description is
            accessible to users. Further information on how to do this can be
            found in [<a href="#bib-UAAG">UAAG</a>].</p>
        </div>
      </section>
      <section id="extensions-to-the-element-interface">
        <h3><span class="secno">3.1 </span>Extension to the <code><a title="element"
              class="externalDFN"
              data-spec="HTML5">HTMLImageElement</a></code>
          interface</h3>
        <pre class="idl"><span class="idlInterface" id="idl-def-Element">partial interface <span
class="idlInterfaceID">HTMLImageElement</span> {
<span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a></span> <span
class="idlAttrName"><a
href="#widl-Element-longdesc">longdesc</a></span>;</span>
};</span></pre>
        <section id="attributes">
          <h4><span class="secno">3.1.1 </span>Attribute</h4>
          <dl class="attributes">
            <dt id="widl-Element-longdesc"><code>longdesc</code> of type <span
                class="idlAttrType"><a>DOMString</a></span></dt>
            <dd>
              <p class="rfc2119">The <dfn id="dfn-dom-element-longdesc"><code>longdesc</code></dfn>
                IDL attribute <em class="rfc2119">must</em> be a valid
                non-empty URL potentially surrounded by spaces. It represents a
                hyperlink to a detailed description of the image its parent <code><a
                    title="element"
                    class="externalDFN"
                    data-spec="DOM4">HTMLImageElement</a></code>
                represents.</p>
            </dd>
            <dd>
              <p>The <code>longdesc</code> IDL attribute <em class="rfc2119">must</em>
                <a href="http://www.w3.org/TR/html5/infrastructure.html#reflect">reflect</a>
                the HTML content attribute <code>longdesc</code>.<br>
              </p>
            </dd>
            <dd>
              <dl class="domintro">
                <dt><var>image</var>.<code title="dom-Element-innerHTML">longdesc</code>
                  [ = <var>value</var> ] </dt>
                <dd>
                  <p>Returns a DOMString that represents the attribute's
                    contents. </p>
                  <p>Can be set, to replace the contents of the attribute with
                    the given string.</p>
                </dd>
              </dl>
            </dd>
          </dl>
          <pre class="example"><code>//Make the first internal longdesc reference absolute

var baseURL = document.location.origin + document.location.pathname
var someImage = document.querySelector('img[longdesc^=#]');

someImage.longdesc = baseURL + someImage.longdesc;</code></pre>
          <pre class="example"><code>//Open new windows for each longdesc found

var describedImages = document.querySelectorAll('img[longdesc]');

for (i in describedImages) {
  if (i.<strong>longdesc</strong>)
    window.open(i.<strong>longdesc</strong>);
}</code></pre>
          <pre class="example"><code>//Tries to repair errors where the longdesc isn't a URI

var describedImages = document.querySelectorAll('img[longdesc]');

for (i in describedImages) {
  if (i.longdesc &amp;&amp; !(validURL(i.longdesc)) { //assumes some URL validating function
    var theData = encodeURIComponent(i.longdesc);
    i.longdesc = "data:text/plain;charset=";
    i.longdesc += document.charset;
    i.longdesc += theData;
  }
}</code></pre>
        </section>
      </section>
      <section class="appendix" id="acknowledgements">
        <h2><span class="secno">A. </span>Acknowledgements</h2>
        <p>Thanks to the HTML Working group of the late 1990s for the original
          specification of longdesc, to those who have implemented it in various
          kinds of software, and to many many people involved with the
          development of HTML5 (including but not limited to those who discussed
          "ISSUE-30" in the HTML Working Group, the Protocols and Formats
          Working Group, the W3C Advisory Board, and around countless dinner
          tables, coffee breaks, and elsewhere) for the ideas, discussions and
          contributions that led to the initial draft of this specification.
          With the exception of Laura Carlson, who did far more very valuable
          work than it took me to produce this specification, I haven't named
          them: the list might be larger than the content of the specification.</p>
        <p>For specific comments and suggestions that led to improvements over
          successive drafts of this specification, thanks to the W3C's HTML
          Accessibility Task Force, the W3C Internationalisation Working Group,
          and to Jonathan Avila, Robin Berjon, James Craig, Steve Faulkner, John
          Foliot, Geoff Freed, Richard Ishida, Anne van Kesteren, David
          McDonald, Jay Munro, Leif Halvard Silli, Mathew Turvey and Boris
          Zbarsky. Any errors are despite, not as a result of, their efforts.</p>
      </section>
      <section class="appendix" id="references">
        <h2><span class="secno">B. </span>References</h2>
        <section id="normative-references">
          <h3><span class="secno">B.1 </span>Normative references</h3>
          <dl class="bibliography">
            <dt id="bib-HTML5">[HTML5]</dt>
            <dd>Robin Berjon et. al., eds. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a>
              W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a>
            </dd>
            <dt id="bib-RFC2119">[RFC2119]</dt>
            <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
+                21501</a> and its dependent bugs.</span></p>
        </div>
        <h4>3.0.2 Authors</h4>
        <p>Authors <em class="rfc2119">should</em> put descriptions within an
          element which is the target of a fragment link (e.g. <code>longdesc="example.html#description"</code>)
          if a description is only part of the target document. </p>
        <div class="note">
          <p><em>This section is informative</em></p>
          <p>Best practices for full descriptions of images are beyond the scope
            of this document, but there are many resources available.</p>
          <p>This document does not define the term "accessible" nor
            accessibility. For further guidance on making an accessible
            document, authors can consult e.g. [<a href="#bib-WCAG2">WCAG</a>].</p>
        </div>
        <h4>3.0.3 User Agents</h4>
        <p>If the <code>longdesc</code> value is a valid URI, User agents <em
            class="rfc2119">must</em>
          make the link available to all users through the regular user
          interface(s).&nbsp; </p>
        <p>If the <code>longdesc</code> value is a valid URI, User agents <em
            class="rfc2119">must</em>
          expose the link to relevant APIs, especially accessibility-oriented
          APIs.<br>
        </p>
        <p>User agents <em class="rfc2119">should</em> enable users to discover
          when images in a page contain a long description.</p>
        <div class="note">
          <p><em>This section is informative</em></p>
          <p>Complete documentation of best practices for implementation is
            beyond the scope of this document. However the following notes are
            offered to help repair a common authoring mistake and avoid a common
            user agent mistake.</p>
          <p>One of the most common mistakes authors make that is easily
            repaired by user agents is to use a description, instead of a URL
            that links to a description. This means there is often plain text
            description in the content of an invalid longdesc attribute.
            Converting such attributes to data URLs is a simple repair strategy
            that can help recover from cases where authors have made this
            mistake. </p>
          <p>Since some images with long description are also normal link
            content, it is important for implementations to ensure that users
            can activate both behaviours. Likewise, it is generally helpful when
            the behaviour for finding, reading, and returning from a long
            description to the image described is a consistent experience.</p>
          <p>Obviously, it is important that access to the long description is
            accessible to users. Further information on how to do this can be
            found in [<a href="#bib-UAAG">UAAG</a>].</p>
        </div>
      </section>
      <section id="extensions-to-the-element-interface">
        <h3><span class="secno">3.1 </span>Extension to the <code><a title="element"
              class="externalDFN"
              data-spec="HTML5">HTMLImageElement</a></code>
          interface</h3>
        <pre class="idl"><span class="idlInterface" id="idl-def-Element">partial interface <span
class="idlInterfaceID">HTMLImageElement</span> {
<span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a></span> <span
class="idlAttrName"><a
href="#widl-Element-longdesc">longdesc</a></span>;</span>
};</span></pre>
        <section id="attributes">
          <h4><span class="secno">3.1.1 </span>Attribute</h4>
          <dl class="attributes">
            <dt id="widl-Element-longdesc"><code>longdesc</code> of type <span
                class="idlAttrType"><a>DOMString</a></span></dt>
            <dd>
              <p class="rfc2119">The <dfn id="dfn-dom-element-longdesc"><code>longdesc</code></dfn>
                IDL attribute <em class="rfc2119">must</em> be a valid
                non-empty URL potentially surrounded by spaces. It represents a
                hyperlink to a detailed description of the image its parent <code><a
                    title="element"
                    class="externalDFN"
                    data-spec="DOM4">HTMLImageElement</a></code>
                represents.</p>
            </dd>
            <dd>
              <p>The <code>longdesc</code> IDL attribute <em class="rfc2119">must</em>
                <a href="http://www.w3.org/TR/html5/infrastructure.html#reflect">reflect</a>
                the HTML content attribute <code>longdesc</code>.<br>
              </p>
            </dd>
            <dd>
              <dl class="domintro">
                <dt><var>image</var>.<code title="dom-Element-innerHTML">longdesc</code>
                  [ = <var>value</var> ] </dt>
                <dd>
                  <p>Returns a DOMString that represents the attribute's
                    contents. </p>
                  <p>Can be set, to replace the contents of the attribute with
                    the given string.</p>
                </dd>
              </dl>
            </dd>
          </dl>
          <pre class="example"><code>//Make the first internal longdesc reference absolute

var baseURL = document.location.origin + document.location.pathname
var someImage = document.querySelector('img[longdesc^=#]');

someImage.longdesc = baseURL + someImage.longdesc;</code></pre>
          <pre class="example"><code>//Open new windows for each longdesc found

var describedImages = document.querySelectorAll('img[longdesc]');

for (i in describedImages) {
  if (i.<strong>longdesc</strong>)
    window.open(i.<strong>longdesc</strong>);
}</code></pre>
          <pre class="example"><code>//Tries to repair errors where the longdesc isn't a URI

var describedImages = document.querySelectorAll('img[longdesc]');

for (i in describedImages) {
  if (i.longdesc &amp;&amp; !(validURL(i.longdesc)) { //assumes some URL validating function
    var theData = encodeURIComponent(i.longdesc);
    i.longdesc = "data:text/plain;charset=";
    i.longdesc += document.charset;
    i.longdesc += theData;
  }
}</code></pre>
        </section>
      </section>
      <section class="appendix" id="acknowledgements">
        <h2><span class="secno">A. </span>Acknowledgements</h2>
        <p>Thanks to the HTML Working group of the late 1990s for the original
          specification of longdesc, to those who have implemented it in various
          kinds of software, and to many many people involved with the
          development of HTML5 (including but not limited to those who discussed
          "ISSUE-30" in the HTML Working Group, the Protocols and Formats
          Working Group, the W3C Advisory Board, and around countless dinner
          tables, coffee breaks, and elsewhere) for the ideas, discussions and
          contributions that led to the initial draft of this specification.
          With the exception of Laura Carlson, who did far more very valuable
          work than it took me to produce this specification, I haven't named
          them: the list might be larger than the content of the specification.</p>
        <p>For specific comments and suggestions that led to improvements over
          successive drafts of this specification, thanks to the W3C's HTML
          Accessibility Task Force, the W3C Internationalisation Working Group,
          and to Jonathan Avila, Robin Berjon, James Craig, Steve Faulkner, John
          Foliot, Geoff Freed, Richard Ishida, Anne van Kesteren, David
          McDonald, Jay Munro, Devarshi Pant, Leif Halvard Silli, Mathew Turvey
          and Boris Zbarsky. Any errors are despite, not as a result of, their
          efforts.</p>
      </section>
      <section class="appendix" id="references">
        <h2><span class="secno">B. </span>References</h2>
        <section id="normative-references">
          <h3><span class="secno">B.1 </span>Normative references</h3>
          <dl class="bibliography">
            <dt id="bib-HTML5">[HTML5]</dt>
            <dd>Robin Berjon et. al., eds. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a>
              W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a>
            </dd>
            <dt id="bib-RFC2119">[RFC2119]</dt>
            <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
                   words for use in RFCs to Indicate Requirement Levels.</cite></a>
              March 1997. Internet RFC 2119. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a></dd>
            <dt id="bib-WEBIDL">[WEBIDL]</dt>
            <dd>Cameron McCormack. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite>Web
                   IDL.</cite></a> 27 September 2011. W3C Working Draft. (Work in
              progress.) URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a></dd>
          </dl>
        </section>
        <section id="informative-references">
          <h3><span class="secno">B.2 </span>Informative references</h3>
          <dl class="bibliography">
            <dt id="bib-ATAGB3">[ATAGB3]</dt>
            <dd>Jutta Treviranus et. al., eds. <a href="http://www.w3.org/TR/ATAG20-TECHS/#principle_b3"><cite>Implementing
                   ATAG 2.0</cite></a>, Principle B3 "Authors must be supported
              in improving the accessibility of existing content" October 2011.
              W3C Working Draft. URL: <a href="http://www.w3.org/TR/ATAG20-TECHS/#principle_b3">http://www.w3.org/TR/ATAG20-TECHS/#principle_b3</a></dd>
            <dt id="bib-WCAG2">[WCAG]</dt>
            <dd>Ben Caldwell et. al., eds. <a href="http://www.w3.org/TR/2008/REC-WCAG20-20081211/"><cite>Web