Re: Request to Reconsider Alt Guidance Location

On Sun, Feb 26, 2012 at 6:51 PM, Leif Halvard Silli
<xn--mlform-iua@xn--mlform-iua.no> wrote:
> So the CP should probably explain why this change would be better.

Indeed.

> On the other side: The current HTML5-conformance validation — like the
> HTML4 validation — has a 'loop hole subset': Presence of an empty alt
> attribute, will always make the img validate - regardless of generator
> string or other gotchas.

[snip]

> So, while an HTML5 validator will display an
> error for
>
>         <a href=foo ><img src=bar ></a>
>
>   it will not display an error for
>
>         <a href=foo ><img src=bar alt='' ></a>
>
> Thus, the simple route to validity, for lazy authors and authoring
> tools, remains to include an empty alt=''.

[snip]

> But then
> again, it could perhaps also be possible to plug this hole in the HTML5
> validation - e.g. by making the latter example an error.

It already is.

The HTML5 spec currently says:

"When an a element that creates a hyperlink, or a button element, has
no textual content but contains one or more images, the alt attributes
must contain text that together convey the purpose of the link or
button."

http://dev.w3.org/html5/spec/the-img-element.html#a-link-or-button-containing-nothing-but-the-image

A conformance checker can't easily verify provided non-whitespace
text, but it's trivial to detect empty or whitespace @alt values and
raise an error in this case.

--
Benjamin Hawkes-Lewis

Received on Sunday, 26 February 2012 19:46:54 UTC