[whatwg] alt="" and the <meta name=generator> exception

Ian Hickson ian at hixie.ch
Wed Aug 1 00:56:46 PDT 2012


On Tue, 24 Jul 2012, Jukka K. Korpela wrote:
> 2012-07-24 21:58, Ian Hickson wrote:
> > On Tue, 24 Jul 2012, Edward O'Connor wrote:
> > > 
> > > The spec currently disallows conformance checkers from reporting 
> > > <img> elements without alt="" attributes as an error when <meta 
> > > name=generator> is present[1].
> > 
> > I've adjusted the text to make it clearer that validators can report 
> > the error in this case, just that they are discouraged from doing so.
> 
> This is an improvement, but I think Edward O'Connor's points still 
> apply. Just saying that the page was generated by a generator has no 
> logical relationship to the issue of alt texts.

Yes, it does. Only generators are in a position where they might have to 
include images for which they lack the ability to provide alt texts.


> I think it would be better to keep the alt attribute always required but
> recommend that conformance checkers have an option of switching off errors
> related to this, due to situations where automatically generated markup
> contains a large number of img elements without alt attributes. Such
> situations can be *understandable* for practical reasons, but this does not
> make the markup good and recommendable.

On Wed, 25 Jul 2012, Henri Sivonen wrote:
> 
> The big question is whether that would be enough to solve the problem of 
> generators generating bogus alts in order to pass validation. I predict 
> generator writers would want the generator output to pass validation 
> with the default settings and, therefore, what you suggest wouldn't fix 
> the problem that the spec is trying to fix.

I agree with Henri here.


On Wed, 25 Jul 2012, Jukka K. Korpela wrote:
> 
> Quite possibly. We cannot prevent people from writing and selling buggy 
> software. A generator may produce valid code, or invalid code. We should 
> not change the definition of valid just to match some generator 
> behavior.

The problem is that some generators -- e.g. software that converts word 
processor documents to HTML -- are in a position where they sometimes 
cannot possibly comply to the requirement. Image recognition and context 
analysis simply isn't good enough yet to handle this case.


> After all, what's the point of using validation if you use a generator? 

People use validators to spot-check things all the time.


> You would in effect be testing the generator, something that its vendor 
> should have done. We should not be concerned about helping generator 
> vendors to advertize their products as producing valid code (code that 
> passes validation) when they in fact produce code that violates 
> established good practices of HTML.

Yes and no. It's unfortunate to force such vendors into a position of 
having to defend their one validation error when there's nothing they can 
do about it, and when the validation error in question is one they can so 
easily silence (without improving their conformance, and potentially 
harming the semantics at the same time).


> According to normal accessibility principles, a generically informative 
> alt attribute is better than no alt attribute, which just says "here's 
> an image and we're not telling you anything about it, probably because a 
> lazy author didn't give the issue any thought".

That's what the absence of an alt="" attribute means.


> Even alt="unknown image" or alt="unknown image named foobar.jpg" is 
> better than lack of alt attribute (or alt="").

On the contrary; alt="unknown image" is equivalent to <span>unknown 
image</span> and would be fine alt="" text for an image of text that says 
"unknown image" or of an icon that represents an unknown image, but would 
be quite incorrect alt="" text for an image whose contents are unknown at 
the time of publication.


On Wed, 25 Jul 2012, Leif Halvard Silli wrote:
> 
> How about simply introducing a @generator attribute:
> 
>      <img generator='foo' alt='' src=bar.jpg />

In the past I have argued against this, on the basis that it is highly 
likely to be abused and actually make things worse. (The idea has been 
brought up numerous times over the past few years, in many forms.)

However, a few years of experience with the <meta> "generator" idea have 
not led Henri and Mike (validator authors) to feel that the problem has 
been suitably addressed, and Mike is now implementing alternatives, so 
clearly it is time for me to revisit that. :-)

We briefly brainstormed some ideas on #whatwg earlier tonight, and one 
name in particular that I think could work is the absurdly long

   <img src="..." generator-unable-to-provide-required-alt="">

This has several key characteristics that I think are good:

 - it's long, so people aren't going to want to type it out
 - it's long, so it will stick out in copy-and-paste scenarios
 - it's emminently searchable (long unique term) and so will likely lead 
   to good documentation if it's adopted
 - the "generator" part implies that it's for use by generators, and may 
   discourage authors from using it
 - the "unable" and "required" parts make it obvious that using this 
   attribute is an act of last resort

This attribute would be non-conforming except when provided in markup 
generated by user agents that find themselves with an image and no 
suitable alt="" text. It would be a third option in the "Images whose 
contents are not known" section of the spec. It would be mentioned in the 
"Guidance for markup generators" section, along with some text about using 
one of the other two alternatives when the image in question is the center 
of attention on the page (as in the Flickr case), rather than using this 
new attribute. It would replace the "generator" exception in the "Guidance 
for conformance checkers" section. The note in the "generator" section 
would be removed.

If we do this, I think we should commit to revisiting the issue in a year 
or two, to examine what impact this is having on Web pages: is the 
attribute used in inappropriate ways? Is it used badly more than 
correctly? Are validator users more or less happy? Most importantly, are 
alt="" texts overall better or worse? Have any generators started using 
the attribute rather than outputting bogus alt="" values?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list