WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Regarding images lacking alts

for

From: Bryan Garaventa
Date: Dec 8, 2012 3:58AM


True, that is the purpose of the first script. It would be nice if FS
programmed JAWS to ignore images without alts, but even if they did at some
point, all prior versions would have the same problem.

I've been giving this some thought, and I know that others here have said
that they don't see the point in this script, and that they don't see that
it fixes anything. It does however make images more uniformly configured for
accessibility however.

I'll show you an example of what I mean.

Here are various image configurations, which you can paste into an html
file.

<img src="img1.jpg" />

<img title="Test2" src="img2.jpg" />

<img alt="Test3" src="img3.jpg" />

<img alt="" src="img4.jpg" />

<a href="url">
<img src="img5.jpg" />
</a>

Now, run the following jQuery script to configure the images accessibly.

// Loop through all images
$('img').each(function(i, o){
var hasAlt = o.getAttributeNode('alt') ? true : false,
hasTitle = o.getAttributeNode('title') ? true : false;
// If no alt, copy the title if present, otherwise set to null (for IE)
if (!hasAlt) $(o).attr('alt', hasTitle ? o.title : '');
// If no title, copy the alt (for FF Chrome and Safari)
if (!hasTitle) $(o).attr('title', o.alt);
});

I've tested this in IE, FF, and Chrome using both JAWS and NVDA, and have
found no negative effects, and the feedback was improved in JAWS.

So the argument earlier was, just run the page against an HTML validator and
program the images correctly the first time. This is true when editing a
particular page.

Now imagine this instead, if you were to paste this code into the global
script for Facebook, it would correct the images on over one billion pages,
instantly.

The same is true for Amazon, Wordpress, Microsoft, Target, CNN, Google, and
so on.

Does this make more sense now?


----- Original Message -----
From: "David Ashleydale" < <EMAIL REMOVED> >
To: "WebAIM Discussion List" < <EMAIL REMOVED> >
Sent: Thursday, December 06, 2012 9:33 AM
Subject: Re: [WebAIM] Regarding images lacking alts


> Correct me if I'm wrong, but I thought one of the purposes of the first
> script that Bryan wrote in this thread was to make the experience of
> encountering images with no alt attribute better by at least assigning an
> empty alt. I've noticed that JAWS tries to be "helpful" by reading the
> source path out loud when there's no alt attribute. So I see this script
> as
> something that could be included in a browser extension like Readability
> to
> make the encountering of images with no alt less annoying.
>
> However, now that I think of it, perhaps Freedom Scientific should change
> the way that JAWS reads these. Wouldn't it be better if it treated no alt
> the same way as it treats alt=""? I realize that it's trying to be
> helpful,
> but it's so often not.
>
> David
> > >