[whatwg] Linters should complain about missing accessible names for controls [Was: Re: alt="" and the <meta name=generator> exception]

Benjamin Hawkes-Lewis bhawkeslewis at googlemail.com
Sat Aug 4 12:32:56 PDT 2012

On Sat, Aug 4, 2012 at 7:08 AM, Michael[tm] Smith <mike at w3.org> wrote:
> Ian Hickson <ian at hixie.ch>, 2012-08-01 07:56 +0000:
>> 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
> Speaking as a validator contributor-implementor, I support the addition of
> this attribute, with the "generator-unable-to-provide-required-alt" name or
> at the very least with the characteristics of the name Hixie outlines here.
> Moreover, I intend to implement experimental support for it in the
> validator.nu engine relatively soon. Henri has also stated that he thinks a
> related proposal from Ted O'Connor for a similar attribute but with a
> different name ("relaxed") "would be eligible for implementation in
> Validator.nu if the proposal were adopted by the HTML WG".
>   http://lists.w3.org/Archives/Public/public-html/2012Aug/0020.html
> I suspect that Ted would be amenable to updating that proposal to use the
> "generator-unable-to-provide-required-alt" instead of "relaxed", so I think
> we have convergence on agreement for adding this attribute.
>> 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.
> I support all those changes. I can't speak for Henri on all those points,
> but note that Henri has also recently indicated he's agreeable to dropping
> the "generator" section -
>   http://lists.w3.org/Archives/Public/public-html/2012Aug/0020.html
>   "I agree that <meta name=generator> is a bad solution both because it
>   tries to repurpose existing syntax in a way that's not expected by the
>   current generators of the syntax and because of its lack of
>   granularity."
>> 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?
> Agreed. I support making having some kind of "trial period" like what you
> describe, or a year or two or 18 months. If we do that I would prefer that
> the spec include some kind of note/warning making it clear that the
> attribute is experimental and may be dropped or changed significantly
> within the next two years based on analysis we get back during that time.

This sounds reasonable I guess.

Would it be possible to combine this with the linter complaining about
all controls (links, buttons, form fields) have markup that yield a
non-empty "accessible name" without invoking repair techniques such as
reading filenames without img @src attributes?


I realise the author requirements in the HTML spec seem to have
gradually become very forgiving here, not really sure why. :( I
realise that from a linting perspective this isn't 100% simple as you
need to check for alternate sources of accessible names like
@aria-labelledby and @title etc, and that the algorithm for doing this
isn't really properly defined … anywhere … Seemingly falling into the
cracks between the ARIA spec, Steve's mapping guide, and the WHATWG
HTML spec.

The cases where markup generators cannot provide a better control name
than _nothing_ seem to me much rarer than the cases where markup
generators cannot provide better text alternatives for photos etc -
maybe even non-existent - and when hand-authoring describing a control
is even easier than coming up with a text equivalent for a graphic.

It would help catch the not uncommon antipattern where the "content"
of a link or button is provided only by a background image.

   <a href="somewhere"></a>
   <a href="somewhere-else"></a>

   <button class="delete"></button>


I'm especially keen on hearing about plausibility from Henri and Michael.

Benjamin Hawkes-Lewis

More information about the whatwg mailing list