This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21987 - Consider adding a sister attribute to act as a toggle to trigger longdesc discoverability.
Summary: Consider adding a sister attribute to act as a toggle to trigger longdesc dis...
Status: CLOSED WORKSFORME
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML Image Description Extension (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Charles McCathieNevile
QA Contact: HTML WG Bugzilla archive list
URL: http://www.w3.org/TR/HTML-longdesc
Whiteboard:
Keywords: a11y, a11y_text-alt
Depends on:
Blocks:
 
Reported: 2013-05-09 16:47 UTC by Laura Carlson
Modified: 2013-05-29 17:40 UTC (History)
3 users (show)

See Also:


Attachments

Description Laura Carlson 2013-05-09 16:47:23 UTC
To trigger longdesc discoverability please consider adding an optional sister attribute such as "longdesclink" or perhaps a more generically named "longdescdisplay" or "longdescdiscover" or "longdescsurface" to act in conjunction with longdesc.

The new attribute could work with discoverability methods such as highlighting, direct replacement, and especially links. Such an attribute would be valuable in toggling longdesc links on in visual browsers and in turn make it more useful to users. 

For example with markup such as:

<img src="linegraph.jpg" 
  alt="Line graph of the number of subscribers" 
  longdesc="longdesc/linegraph.html" 
  longdesclink>

The presence of the longdesclink attribute could trigger a browser to output the link text:
"Long Description: Line graph of the number of subscribers"
which consists of the string "Long Description: " plus the alt attribute's value.

Lack of the sister attribute "longdesclink" would mean to not force a visual encumbrance upon users by not displaying the link.

References:

longdesc extensions that surface the longdesc link to make it discoverable include: 

* FireFox's Longdesk Extension, which adds a link to the longdesc under images that have a longdesc attribute
http://www.d.umn.edu/~lcarlson/research/ld-ua.html#longdesk

* A longdesc favelet, which first announces the number of images on the page that have longdesc attributes. Then it highlights each image on the page that has a longdesc, and provides on-screen text links to each corresponding description.
http://www.d.umn.edu/~lcarlson/research/ld-ua.html#favelet

* Opera's TellMeMore extension provides a link in a popup context menu. 
http://www.d.umn.edu/~lcarlson/research/ld-ua.html#pouplist

Please note: 

Chris Mills originated the idea for this attribute in a private longdesc discussion with me. Thank you Chris!
Comment 1 Charles McCathieNevile 2013-05-09 17:25:55 UTC
I don't think this is necessary. I can't think of anything that could be done with this that cannot already be done by noting that there is a longdesc attribute.

In my TellMeMore extensions I use document.querySelectorAll('img[longdesc]') to get a list of the elements with longdesc.

Doing something in CSS like

  img[longdesc] { border: red dashed 2px}

would provide a border on each image that has a longdesc attribute (there are obviously more complex things that could be done here, this is just the simplest I can think of).

  img[longdesc^=#] { border: none}

following the first declaration will cancel the effect for images whose longdesc is a link internal to the page.

And so on.

So I propose to reject the bug.
Comment 2 Chris Mills 2013-05-10 09:01:37 UTC
Chaals is absolutely right of course - I agree that there is nothing really that can't already be done.

But I was thinking of an easier way to add discoverability for longdesc targets. Specifically I was thinking that if you added this "longdesclink" (or whatever) attribute to images, it would cause the browser to display a link to the longdesc target next to the image. So for example

<img src="linegraph.jpg" 
  alt="Line graph of the number of subscribers" 
  longdesc="longdesc/linegraph.html" 
  longdesclink>

Would result in the browser displaying

<a href="longdesc/linegraph.html">Line graph of the number of subscribers</a>

beside the image at runtime.

Yes, this would be trivial to knock together with script, but even so, script is not within the realms of everyone.
Comment 3 Laura Carlson 2013-05-10 11:28:48 UTC
(In reply to comment #2)
> even so, script is not within the realms of everyone.

This is true. Not all authors know JavaScript or CSS. I don't see why the browser couldn't provide an easy way to do this, for authors of limited skill sets.
Comment 4 Charles McCathieNevile 2013-05-10 22:11:24 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > even so, script is not within the realms of everyone.
> 
> This is true. Not all authors know JavaScript or CSS. I don't see why the
> browser couldn't provide an easy way to do this, for authors of limited
> skill sets.

The browser could. But having the attribute won't make it happen either - what is needed is the code, and getting it into a browser.

The simplest way to do that, of course, is an extension. Here's some horrible code that could be used, but anyone who can write a browser extension (tens of thousands of people can) would probably reject this code as hideous and write something neater.

document.onload = (function(){
 function islinked(element) {
  if (element.tagName == 'A')
    return true;
  else if (element.tagName == 'BODY')
    return false;
  else
    return (islinked(i.parentElement));
 }
 function addlink(describedImage){
  var newLink = document.createElement('a');
  newLink.href = describedImage.longdesc;
  newLink.innerText = "[description of the image]";
  if (describedImage.nextSibling)
    describedImage.parentElement.insertBefore((describedImage.nextSibling),newLink);
  else
    describedImage.parent.appendChild(newLink)
 }
//LinkNextToParent is a blend of the last two functions..
 var theimages = document.querySelectorAll('img[longdesc]');
 for (i in theimages) {
  if (! isLinked(i))
    addlink(i);
  else
    linkNextToParent(i);
 }

})
Comment 5 Laura Carlson 2013-05-13 11:34:34 UTC
Hi Chaals,

(In reply to comment #4)
>>> (In reply to comment #3)
>> (In reply to comment #2)
>> > even so, script is not within the realms of everyone.
>> 
>> This is true. Not all authors know JavaScript or CSS. I don't see why the
>> browser couldn't provide an easy way to do this, for authors of limited
>> skill sets.

> The browser could.

Yes. I believe that getting it implemented is what Chris had in mind. Specifying a new attribute would allow browsers to enable a *super simple*  way for *authors* to explicitly trigger longdesc discoverability on individual images. It would provide author control of design in a granular manner.

> The simplest way to do that, of course, is an extension.

Do you mean a browser extension or an authoring tool extension? 

As you already know and as previously noted we already have various browser extensions that enable direct user discoverability in browsers  [1]. 

Does your code do anything different than provide direct user discoverability? 

Does it allow authors or authoring tools to simply add a sister attribute (whatever it be named) into their markup in a conforming way that will make longdesc discoverable? Again, the idea of the sister attribute is to allow authors to easily surface discoverability in browsers by adding a simple sister attribute. Then if that sister attribute was present, browsers would do something: add the link or a border or an icon or whatever in whatever way was agreed upon for that particular device.

Thanks.

[1] http://www.d.umn.edu/~lcarlson/research/ld-ua.html
Comment 6 Charles McCathieNevile 2013-05-13 11:52:26 UTC
(In reply to comment #5)
> Hi Chaals,
> 
> (In reply to comment #4)
> >>> (In reply to comment #3)
> >> (In reply to comment #2)
> >> > even so, script is not within the realms of everyone.
> >> 
> >> This is true. Not all authors know JavaScript or CSS. I don't see why the
> >> browser couldn't provide an easy way to do this, for authors of limited
> >> skill sets.
> 
> > The browser could.
> 
> Yes. I believe that getting it implemented is what Chris had in mind.
> Specifying a new attribute would allow browsers to enable a *super simple* 
> way for *authors* to explicitly trigger longdesc discoverability on
> individual images.

Sure, but it is just as easy for browsers to enable the discoverability based on the presence of the longdesc attribute itself. And more reliable - browsers will be unhappy if you ask them to do this, and they start seeing "longdesclink" attributes when there is no actual longdesc.

I also think it will actually confuse authors and there will be 

<img src="..." longdesc="oops I put a description in here" londesclink="http://example.com/what/should/have/been/in/the/longdesc/attribute.html" ...

> It would provide author control of design in a granular
> manner.

Yeah, but this is misxing presentation back into the structure, which I think is a bad idea.
 
> > The simplest way to do that, of course, is an extension.
> 
> Do you mean a browser extension or an authoring tool extension? 

browser extension, but the same applies to authoring tool extensions

> As you already know and as previously noted we already have various browser
> extensions that enable direct user discoverability in browsers  [1]. 

yep.

> Does your code do anything different than provide direct user
> discoverability? 

No, that sample provides the discoverability you're looking for in a browser, based on the presence of a longdesc attribute. With an extra simple function, it can checkthat the attribute is valid in the first place, and if it isn't, e.g. it is a description instead of a link, it could convert that to a data URL (using the code example in the spec draft already) and still add the link...

> Does it allow authors or authoring tools to simply add a sister attribute
> (whatever it be named) into their markup in a conforming way that will make
> longdesc discoverable? Again, the idea of the sister attribute is to allow
> authors to easily surface discoverability in browsers by adding a simple
> sister attribute. Then if that sister attribute was present, browsers would
> do something: add the link or a border or an icon or whatever in whatever
> way was agreed upon for that particular device.

I don't think it should be done this way. If authors want to surface discoverability, they can write CSS. If users want to do so, they can install user CSS or a JS extension, depending on their needs and desires. To make this possible I think the right way is to use the presence of the longdesc attribute itself as the trigger.

(I agree that easy discoverability is important. I think I wrote the first implementation that provided it. I just thinkthat an extra attribute is not a good way to do it, since you can do it with the existing attribute - and in practice, more effectively IMHO).
Comment 7 Laura Carlson 2013-05-13 12:24:31 UTC
(In reply to comment #6)

Thanks Chaals. All good points. 

Chris do you agree? If so I'm okay with closing this bug.
Comment 8 Charles McCathieNevile 2013-05-17 17:40:08 UTC
The Task force agreed that we don't need to do this, because the use cases can be met by the longdesc attribute on its own with exactly the same amount of work.