Hacker News new | past | comments | ask | show | jobs | submit login

> You use ALT text by adding the alt attribute with a value of the text equivalent of your image, like so:

> <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 W3C's Web Content Accessibility Guidelines (the gold standard for web accessibility and the usual legal requirement) only requires that images of text have "text alternatives" - it doesn't require the alt attribute specifically. Your solution to just use text alongside the image should be fine in most cases.

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.


Why not allow the visually impaired to experience the pointless and gratuitous images the rest of us have to endure?

Just kidding of course. I always put blank alt attributes on images that are used purely for decoration, and nobody has complained.


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

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.


> Am I totally off base here?

https://www.w3.org/TR/WCAG20-TECHS/H37.html


From that link:

> 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?


It's in the last sentence you pasted: > The instruction to "select a room" indicates that the image is interactive.

That assumption is that the rooms are selectable, so "tabbing" with a screen reader will select each and speak their Alt text.


The alt text you quoted still sets mood and setting. In terms of capturing reader interest, narrative is important. How would this hurt?


I feel like screen-reader-capable text should always have two options, since so many things in life benefit from a detail option: “give me the tl;dr” with an option for “more” if I want it.

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




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: