WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: alt or alt=""

for

Number of posts in this thread: 7 (In chronological order)

From: glen walker
Date: Fri, Aug 30 2019 5:29PM
Subject: alt or alt=""
No previous message | Next message →

I've always recommended specifying alt="" for decorative images and am not
sure why I didn't think of this earlier but specifying alt without any
value is essentially the same thing. It's valid html syntax and has the
same effect with hiding the image from screen readers.

Seems like a simple thing but does anyone know why we shouldn't use alt by
itself with no value? From an html spec perspective, they're the same
thing.

It's three less characters to type so my lazy developer side likes it.

From: Steve Green
Date: Fri, Aug 30 2019 5:47PM
Subject: Re: alt or alt=""
← Previous message | Next message →

Is it possible that some automated accessibility testing tools might report a false positive? They shouldn't, but it's the sort of thing they tend to get wrong because no one thought about it.

In the past we just ignored false positives like this, but since the number of ADA cases skyrocketed we have been advising clients to fix any code that results in false positives even if it's the tool that's wrong and not their code. We know the ADA trolls use automated tools to find their victims, so eliminating false positives reduces your chance of being a target.

Steve Green
Managing Director
Test Partners Ltd


From: Jared Smith
Date: Fri, Aug 30 2019 6:45PM
Subject: Re: alt or alt=""
← Previous message | Next message →

> Is it possible that some automated accessibility testing tools might report a false positive?

They shouldn't, unless they are perhaps evaluating only the raw source
code and not the DOM. Any tool that doesn't evaluate the DOM should be
avoided.

Jared

From: Peter Shikli
Date: Tue, Sep 03 2019 3:33PM
Subject: Re: alt or alt=""
← Previous message | Next message →

As a coder myself, it would be easier to write an if-then-else logic statement to find alt="" than just alt since that latter is part of many other constructs. And alt> cannot be assured to identify a decorative image if some other attribute follows the alt attribute. The net result is that I recommend the extra finger workout to type alt="" to make sure a screen reader catches it correctly and informs the user about decorative images.

Cheers,
Peter Shikli
Access2online

From: glen walker
Date: Tue, Sep 03 2019 3:57PM
Subject: Re: alt or alt=""
← Previous message | Next message →

According to html specs, alt and alt="" are exactly the same.

https://www.w3.org/TR/2012/WD-html-markup-20120329/syntax.html#syntax-attr-empty

"And alt> cannot be assured to identify a decorative image if some other
attribute follows the alt attribute"

I don't follow that. Why does it matter if there's another attribute
following alt?


On Tue, Sep 3, 2019 at 3:43 PM Peter Shikli < = EMAIL ADDRESS REMOVED = > wrote:

> As a coder myself, it would be easier to write an if-then-else logic
> statement to find alt="" than just alt since that latter is part of many
> other constructs. And alt> cannot be assured to identify a decorative image
> if some other attribute follows the alt attribute. The net result is that I
> recommend the extra finger workout to type alt="" to make sure a screen
> reader catches it correctly and informs the user about decorative images.
>
> Cheers,
> Peter Shikli
> Access2online
>
>
> > > > >

From: Mallory
Date: Wed, Sep 04 2019 12:45PM
Subject: Re: alt or alt=""
← Previous message | Next message →

Sounds like maybe a regex for letters a,l,t followed by a angled bracket, however such a regex would also assume the alt attribute is last. There's no rule that it must be last, so authors could easily write
<img alt src="foobar.png">
and such a filter would miss it.

cheers,

On Tue, Sep 3, 2019, at 11:57 PM, glen walker wrote:
> According to html specs, alt and alt="" are exactly the same.
>
> https://www.w3.org/TR/2012/WD-html-markup-20120329/syntax.html#syntax-attr-empty
>
> "And alt> cannot be assured to identify a decorative image if some other
> attribute follows the alt attribute"
>
> I don't follow that. Why does it matter if there's another attribute
> following alt?
>
>
> On Tue, Sep 3, 2019 at 3:43 PM Peter Shikli < = EMAIL ADDRESS REMOVED = > wrote:
>
> > As a coder myself, it would be easier to write an if-then-else logic
> > statement to find alt="" than just alt since that latter is part of many
> > other constructs. And alt> cannot be assured to identify a decorative image
> > if some other attribute follows the alt attribute. The net result is that I
> > recommend the extra finger workout to type alt="" to make sure a screen
> > reader catches it correctly and informs the user about decorative images.
> >
> > Cheers,
> > Peter Shikli
> > Access2online
> >
> >
> > > > > > > > > >
> > > > >

From: Jeremy Echols
Date: Thu, Sep 05 2019 2:38AM
Subject: Re: alt or alt=""
← Previous message | No next message

If any serious accessibility tool is using regexes instead of properly parsing the DOM (pretty much every language has a way to parse HTML), that tool should be dragged into the street and shot.

I suspect every tool out there that's got widespread use just parses the DOM. But if anybody is thinking of writing their own tool to do something like this, and string scanning or regexes are where you go, please don't put those tools out for others to use as part of an audit. Accessibility is tough enough to get right even with great tools.