A way to keep the longdesc target in the same document

If you want, you can cut the crap, and go straight to the demos, and click the first image.

Purpose of this document:

To demonstrate how one can serve a long image description – a longdesc URI – while both keep the description inside the same page and make it accessible for as many as possible. The consept is a variant of what others have called accessibility footnotes. The reason why I call this page an Acid test, is because it is necessary to show How Longdesc Should Be Done™: What the UAs should live up to, and what authors can do, in order to get it used, get it supported etc..

Version notes

Versions: third version of this document published on 2008-04-16 .

Fixes: 2008-04-28: Small fix in the JS code, so the single click works.

Change notes.

Added JavaScript so that browsers (Firefox, Opera 9.5 latest build and WebKit) can open the longdesc URI via doubleclick. An old stylesheet, only working properly in Firefox, is available as an alternative stylesheet.

The main part of this page is still kept as long descripton of the first image, and has not changed. In the next paragraph I add new info about longdesc support. I also added a header element to the footnote, as a signal, to AT users, that this is where the footnote begins. (The alternative would be to have separate footnote elemente, much like HTML 5 offers section elements and so on. Certainly, section could be used for the footnote.)

Compatibility notes

Those browsers that support the CSS :target selector. (Added the ie7 JavaScript library to try to support Internet Explorer.)

And, according to last test, Jaws used with Internet Explorer.

Releated article

I have created a related page more directly related to HTML 5.

Thank you’s

I want to thank Joshue O’Connor from Centre for Inclusive Technology for having tested version 2 of this page, verifying that it worked with JAWS through Internet Explorer, and for his comments on that occassions. (Now, in version 3, with JavaScript, that JAWS/IE compatibility may have changed. Feedback are welcome. Send it to "lhs" on "malform-dot-no".) Also thank you to Laura Carlson for encouraging feedback, and to the HTML4all.org gang in general!

User agents and longdesc support

What is longdesc support?

Javascript

Since the first versions of this document, I have learned that Internet Explorer 8 is expanding support for the longdesc attribute. Reading the Microsoft documentation, I also learned that longdesc has been in the DOM since DOM 1. This inspired me to try this out. And it turns out that all the mayour web browsers support it ... Is this the best kept secret of the longdesc issue? At any rate, because of this, I decided to remove the additional <a href=> links.

Without JavaScript

Otherwise, this info regarding User Agents supporting longdesc without the use of JavaScript still counts:

Firefox with Lauke's longdesc extensions; WebKit based iCab 4 for Mac OS X (and older not Webkit based iCab versions). Of course also assistive readers, both screenreaders (Jaws etc) and not screenreaders. Lauke's Firefox extestion opens the URI in the same window. iCab currently only launches the link in a separate window. (Webkit has a bug with fragment URI-s when they are opened in new window, but this does not seem to affect this iCab in this page.) Both iCab and Firefox you use the contextual menu to select the longdesc URI.

I tested this page with the the Fangs screen reader simulator. The simulator does not support the longdesc attribute. (But perhaps I can trust what Fang's output of how display:none is handeled by screenreaders?)

Demonstrations

And now to the tests. And the included article, for those who are interested. (You might consider reading another article also – or – insteand.)

First demo: longdesc 1

The following image has a long description connected to itself. Inside the long description, you will find a long text regarding longdesc, cross-references, accessibility footnots and more.

All users: Doubleclick to activate the longdesc link. (Unless you are using Jaws etc.)

The interesting stuff is in the longdesc.

For Internet Explorer: You must doubleclick the image twice! After first doubleclick, watch the scrollbar grow. Thenafter, doubleclick one more time on the same image. (Try, and you shall see.) As I said above, for Explorer this is done via JavaScript. Tested this with IE6 where this worked quite fast. Also tried IE8, where it was rather slow. (My computer Windows PC is very slow as well.)

placeholder paragraph

First placeholder header

placeholder paragraph

Second placeholder header

placeholder paragraph

Second test

All users: Here, the longdesc link is activated via single click (instead of doublclick, as above).

Also for this image, the interesting stuff is in the longdesc.

Seventh last placeholder header

placeholder paragraph

Sixt last placeholder header

placeholder paragraph

Fift last placeholder header

placeholder paragraph

Fourth last placeholder header

placeholder paragraph

Third last placeholder header

placeholder paragraph

Second last placeholder header

placeholder paragraph

Last placeholder header

There (appears) to be nothing below this paragraph. But there is more … (follow the longdesc URIs above to get to the rest.)

Longdesc footnote 1.

Table of contents

NB! The TOC links (currently) causese this section to close. The TOC links kind of works. But after you've used one of them, hovering outside the browser window can cause surprises. NB!

1. Implementing the longdesc feature

Two questions perhaps lays behind this text:

  1. How can we generalise the features that longdesc provide?
  2. How can we generalise the longdesce attribute for other purposes than just as a feature for non-sighted?

1.1. Longdesc as “accessibility footnotes”

and other thoughts about how to get support for long descriptions of images in HTML 5.

1.1.1. Classic use of longdesc

The traditional longdesc solution is to keep the long description in another, external document. This has some advantages:

  1. It allows the author to easily read it and work with it.
  2. Since a (longdesc) link does not require JavaScript, it should be widely accessible.
  3. For unsighted users, keeping the long description outside the document, ensures that they do not, accidently, start to read the description out of context (for instance, as a continuation of the last paragraph of the page, instead of as a commentary to an image at another location on the page.).

1.1.2. Disadvantages of the classic use.

  1. Authors find it cumbersome with many documents. It is handy to build things that belongs together into the one and same document.
  2. When kept inside another document, it requires something extra from the user to read it. One are reluctant to load another document.
  3. Sighted users especially espect thigns to happen in the same document. So, as simply a dull page at an external URI, longdesc is not likely to develop into something that all users can make use of.

1.1.3. Lack of a proper way to do it.

But, apart from the, till now, shortcomings of most UAs, authors are in lack of good descriptions about how to create good longdesc users experiences. Though, there have been some attemts. (I don't proclaim to know them all.)

1.1.4. Building on an idea

One of the best ideas is the idea of keeping the long descriptions as «accessibility footnotes». I myself made a proposal that reminds about this idea to the HTML5 working group.

The accessibility footnote idea is at least 4 years old. (See Andy Clarke at Stuff and nonsense.) Andy Clarke, in his example page, kept the footnote inside the same page (that is why it is called a footnote), but hides it for sighted users via the the CSS style display:none; .footnotes{position:absolute; left: -9999px;}, which moves the text outside the screen.

1.1.5. Simple. But does ot work?

Andy Clarke's example is close – on the idea level – to what I want to achieve, namely: Somethingh which is hidden for normal users. But I still see 2-3 problems with his particular approach:

  1. Does the display:none solution actually work for those that use Screenreaders? Doesn't the screen reader need to be able to see the stuff on the screen, in order to make it avablable to the user?
  2. I also want that sighted users shall be able to see the longdesc descrption: The author needs to check it to see that he got it right. At best by activating a link, and not through fiddeling with setting display:block or something, in the code.
  3. At the best, the author and all users should be able to click a link to read the longdesc. It should be there. Be visible. But not disturb anyone.
  4. Perhaps just another way of phrasing the same thing: Clarke's example is not very interactive. (But then it is 4 years old).

1.1.6. You read this now. So, does my idea work?

This is still an early attemt. In its current shape and form, it works the best in Firefox.

1.1.6.1. Update: Clarke's method

I have not discussed which kind of CSS I have used in this text. But my first approach was to fiddle with overflow:hidden and overflow:scroll for the HTML and the BODY elements. Clarke, however and as told, set the longdesc footnote to have .footnote{display:absolute;left:-99999px;}. Now have also implemented his method, with the difference that activating the longdesc URI now moves the footnote inside the window, in front of the rest of the page. Perhaps this method is in fact simpler to master. In both implmentations, the CSS :target selector plays a key role.

1.2. Inspiration: A cite attribute implementation

1.3. Longdesc as a general footnote/endnote implementation?

1.4. Longdesc as a HTML 5 Automatic cross referencing feature?

1.4.1. IMG as a cross-reference element

1.4.2. Hiding the long description: A separate issue.

1.4.3. Possible counter arguments

1.4.4. Possible extensions on the idea

1.4.5. Winning the battle

1.5. Implementation issues

1.5.2. Formal restrictions on the mark-up of descriptions?

1.5.3. Backlinks: Restrictions where they can lead?

1.6. What needs to be done?

  1. Improve this, and other examples. Do you see better solutions? Simpler solution? This is "open source" code.
  2. Work out the requirements: What exactly does a Screenreader need? Can a Screenreader use JavaScript? I have no clue about that? Because, if it can, then there are many Ajax solutions that possibly could be used, as well
  3. Spread the idea. Spread the thoughts.
  4. Get vendors involved.
  5. Specify a test case.

Regarding the last two points, it should be evident from my post to the HTML5 working group that, that I was inspired by the Acid2 test, especially that part which tests the CSS overflow property, which can entirely hide the scroll bar. But this also shows that in order to get thigns going, we need to get the vendors aboard. We must define sometihng that is useable and userful, and get them aboard to support it.

Longdesc footnote 2

Some other links, to see where you land:

long descrption to image 2

This is just fake content, to proof that it is possible with more than one long descriptino per page.

Line 1 of 44 of the 2nd longdesc description

Line 2 of 44 of the 2nd longdesc description

Line 3 of 44 of the 2nd longdesc description

Line 4 of 44 of the 2nd longdesc description

Line 5 of 44 of the 2nd longdesc description

Line 6 of 44 of the 2nd longdesc description

Line 7 of 44 of the 2nd longdesc description

Line 8 of 44 of the 2nd longdesc description

Line 9 of 44 of the 2nd longdesc description

Line 10 of 44 of the 2nd longdesc description

Line 11 of 44 of the 2nd longdesc description

Line 12 of 44 of the 2nd longdesc description

Line 13 of 44 of the 2nd longdesc description

Line 14 of 44 of the 2nd longdesc description

Line 15 of 44 of the 2nd longdesc description

Line 16 of 44 of the 2nd longdesc description

Line 17 of 44 of the 2nd longdesc description

Line 18 of 44 of the 2nd longdesc description

Line 19 of 44 of the 2nd longdesc description

Line 20 of 44 of the 2nd longdesc description

Line 21 of 44 of the 2nd longdesc description

Line 22 of 44 of the 2nd longdesc description

Line 23 of 44 of the 2nd longdesc description

Line 24 of 44 of the 2nd longdesc description

Line 25 of 44 of the 2nd longdesc description

Line 26 of 44 of the 2nd longdesc description

Line 27 of 44 of the 2nd longdesc description

Line 28 of 44 of the 2nd longdesc description

Line 29 of 44 of the 2nd longdesc description

Line 30 of 44 of the 2nd longdesc description

Line 31 of 44 of the 2nd longdesc description

Line 32 of 44 of the 2nd longdesc description

Line 33 of 44 of the 2nd longdesc description

Line 34 of 44 of the 2nd longdesc description

Line 35 of 44 of the 2nd longdesc description

Line 36 of 44 of the 2nd longdesc description

Line 37 of 44 of the 2nd longdesc description

Line 38 of 44 of the 2nd longdesc description

Line 39 of 44 of the 2nd longdesc description

Line 40 of 44 of the 2nd longdesc description

Line 41 of 44 of the 2nd longdesc description

Line 42 of 44 of the 2nd longdesc description

Line 43 of 44 of the 2nd longdesc description

Line 44 of 44 of the 2nd longdesc description