[whatwg] ALT and equivalent representation

Smylers Smylers at stripey.com
Mon Apr 21 02:30:43 PDT 2008


Shannon writes:

> Shannon wrote:
> 
> What about this as a possible solution?
> 
> > <img src="part1.png" altgroup="rating"> 
> > <img src="part2.png" altgroup="rating"> 
> > <img src="part3.png" altgroup="rating"> 
> > <altgroup id="rating" value="3/5"> 
> >
> > I don't think this would raise any serious implementation issues as
> > the logic is quite simple;
> 
> Smylers wrote:
> 
> > What advantage does it have over Simon's proposal?
> >
> > Simon's suggestion has the obvious advantage that it already works with
> > current browsers.
> 
> Simon's suggestion is no different from the original proposal, the idea  
> that alt can be optional on some images.

No, Simon was specifying an alt attribute on each image (see below).

> Fallback for current browsers is something I overlooked but it is easy
> to do:
> 
> <altgroup id="hippo" value="Hippopotamus"> 
> <img src="hippo_head.png" altgroup="hippo" alt="Hippopotamus"> <img  
> src="hippo_tail.png" altgroup="hippo"> 
> 
> With the alt simply being overridden by altgroup in a HTML5 browser.

That still doesn't entirely work with current browsers, because --
unlike Simon's proposal -- you have no alt atttribute at all on the
tail.  That will provoke image-less browsers into using heuristics to
guess what the most appropriate alternative representation is.  Whereas
in this case the most appropriate alternative is clearly to have
nothing, so the author should unambiguously indicate that with alt="".

That's also easy to do; it makes your suggestion be:

  <altgroup id="hippo" value="Hippopotamus">
  <img src="hippo_head.png" altgroup="hippo" alt="Hippopotamus">
  <img src="hippo_tail.png" altgroup="hippo" alt=""> 

For comparision, here's the mark-up following Simon's suggestion:

  <img src="hippo_head.png" alt="Hippopotamus">
  <img src="hippo_tail.png" alt=""> 

Note that your suggestion is a superset of his: in order to get yours to
work with existing browsers you have to do all of his anyway!

So you are effectively asking an author to firstly do something which
works in all known current browsers and _then_ put additional work in
doing something which will make _no difference whatsoever_ to how the
content is presented in any browser at all.  Authors are unlikely to be
motivated to do that.

Shannon writes:

> Benjamin Hawkes-Lewis wrote:
> 
> > But whether we need a mechanism for denoting differing img elements
> > combine to form a single image is a very different question from
> > whether alt should be optional or required. You seem to be
> > conflating them.
> 
> How can <img alt> or <img alt=""> not be related to making alt
> optional?

Because whether the alt attribute is required in all cases (or only
required in those where it's possible to provide a plausible
alternative[*0]) the above will be allowed either way.  Including an alt
attribute and setting it to the empty string (which is what the above
does) _is_ including an alt attribute; it's specifically saying that the
image doesn't convey anything which isn't already conveyed elsewhere on
the page, so for imageless browsing the most appropriate action is to
omit it entirely from the content.

  [*0]  Note it isn't 'optional', in the sense that at no point does the
  author have any option as to whether to include it or not; the spec
  makes it clear that if the author can provide it then she must.

> Once alt text becomes optional then it is likely that many
> designers/templates/wysiwyg applications will simply insert alt=""
> into every image to pass validation without consideration ...

But that's what we currently have with HTML 4 validation!  alt="" is
already allowed (and indeed is useful in many circumstances).

> It is this situation I am trying to avoid.

Too late!

But it's _also_ what HTML 5 is trying to lessen.  One way to improve the
situation is for people (and tools) _not_ to unthinkingly insert alt=""
in situations where that _isn't_ appropriate; where it's impossible to
know what appropriate alt text is then it's better to leave it out
entirely, so as to distinguish these cases.

> A valid document should provide valid alt information, not empty ones.

The spec goes to some length to list different situations in which
images are used and explains why alt="" is the right thing for some of
those.  Please could you elaborate on each of those explaining why the
spec is wrong and what would be more appropriate alt text than alt="".

Smylers



More information about the whatwg mailing list