by perlgeek · 8y ago · 0 comments
> <img src=“https://example.com/image.png” alt=“developer in an office working feverishly to hit a deadline on a software project” />
Is this actually a good idea?
This sounds like a typical "hero" or "teaser" image, to capture the reader's attention or interest. I don't think the alt tag does that in a comparable way, for a screen reader for example. So I'd just leave it blank.
It's really frustrating: all articles on accessibility mention the alt attribute, and that you should use them. But few give guidelines on how to write a good alt attribute that is actually well thought out.
When I write a website that explains things, and uses images, I (nearly) never use only images, but usually images + text. If I put an alt description in the images, I basically duplicate the text, and I guess that will confuse screen reader users more than a blank alt text.
Am I totally off base here?
The only practical difference is that with alt text, the blind person is aware that there's a graphic on the page. With alt="" they have no idea the image exists. Does that matter? Maybe in some contexts - you have to use your best judgment on a case-by-case basis.
It also doesn't require alt text for images that are purely decorative and not necessary to understand the content, though this is a bit subjective. Could a blind reader still imagine the idea of a developer in an office working feverishly to hit a deadline, and would that add to their experience of the article enough to be worth including? Again, there are no hard and fast rules here so you just have to use your best judgment.
Just kidding of course. I always put blank alt attributes on images that are used purely for decoration, and nobody has complained.
You're not alone in feeling this frustration. In fact, this very article includes what I presume to be a screenshot of some code from the React docs. I have to presume that's what it is, because I'm a screen reader user and they haven't provided an alternative, screen reader-accessible version. Go figure.
> An image on a Web site depicts the floor plan of a building. The image is an image map with each room an interactive map area. The alt text is "The building's floor plan. Select a room for more information about the purpose or content of the room." The instruction to "select a room" indicates that the image is interactive.
And how does it help any blind person to know that there is a building plan, but none of the contents of the building plan are described?
Or am I misunderstanding the purpose of the ALT text?
That assumption is that the rooms are selectable, so "tabbing" with a screen reader will select each and speak their Alt text.
I know it’s hard enough to get consistent support for "alt" at all but an "alt-long" might be nice too so you can say things like alt="Picture of ocean landscape" alt-long="An evening shot of a beach in the Maldives, with a full moon, no clouds and still water.".