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


-----Original Message-----
From: WebAIM-Forum < = EMAIL ADDRESS REMOVED = > On Behalf Of glen walker
Sent: 31 August 2019 00:30
To: WebAIM Discussion List < = EMAIL ADDRESS REMOVED = >
Subject: [WebAIM] alt or alt=""

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: 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.

-----Original Message-----
From: WebAIM-Forum < = EMAIL ADDRESS REMOVED = > On Behalf Of Mallory
Sent: Wednesday, September 4, 2019 11:45
To: WebAIM Discussion List < = EMAIL ADDRESS REMOVED = >
Subject: Re: [WebAIM] alt or alt=""

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://urldefense.com/v3/__https://www.w3.org/TR/2012/WD-html-markup-
> 20120329/syntax.html*syntax-attr-empty__;Iw!5W9E9PnL_ac!RTGlp6dAayXLcD
> 6E66LkW8VPT4zaWWpZJLyoAPj-cPch4Pxe0-PPypGo0z-xkYXalg$
>
> "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
> >
> >
> > > > > > https://urldefense.com/v3/__http://list.webaim.org/__;!5W9E9PnL_ac!R
> > TGlp6dAayXLcD6E66LkW8VPT4zaWWpZJLyoAPj-cPch4Pxe0-PPypGo0z8m2iMdNA$
> > List archives at
> > https://urldefense.com/v3/__http://webaim.org/discussion/archives__;
> > !5W9E9PnL_ac!RTGlp6dAayXLcD6E66LkW8VPT4zaWWpZJLyoAPj-cPch4Pxe0-PPypG
> > o0z9id6TdoA$ > >
> > > https://urldefense.com/v3/__http://list.webaim.org/__;!5W9E9PnL_ac!RTG
> lp6dAayXLcD6E66LkW8VPT4zaWWpZJLyoAPj-cPch4Pxe0-PPypGo0z8m2iMdNA$
> List archives at
> https://urldefense.com/v3/__http://webaim.org/discussion/archives__;!5
> W9E9PnL_ac!RTGlp6dAayXLcD6E66LkW8VPT4zaWWpZJLyoAPj-cPch4Pxe0-PPypGo0z9
> id6TdoA$ >