WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: How to dynamically fix thousands of images missing alt attributes using regular expression find and replace

for

From: Jared Smith
Date: Jun 14, 2019 12:59PM


> From what I recall though, the original person was asking how to update the alts for thousands of spacer images that are not informative, and it is impossible to do this manually one by one.

This makes more sense. This could be useful for fixing these. The
concern is that if a web sites has thousands of spacer images without
an alt attribute, they almost certainly have loads of images that
should have alt text defined. These would get caught up in the mix and
be given alt="".

One relatively simple improvement I would recommend is to detect if
the image is inside a link. Such images should never have alt="", so
it would be best to omit these.

Thanks,

Jared