Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Having no alt and having alt="" do not produce the same results to the audiences relying on those attributes to perceive images. The W3C's tutorial on decorative images (found at https://www.w3.org/WAI/tutorials/images/decorative/) says to use alt="" to mark an image decorative, as some (prominent) screen readers will read the image's file name when no alt attribute is set.

But hey, that Svelte is providing these warning is great for accessibility!



Yeah. Thanks. Maybe you'll know this? Is it kosher to user aria-hidden=true for decorative images?

I'm asking because it's not easy convincing a client that alt="" is ok. They've read so many times "also have a value for alt-=. This is especially true of clients who are SEO-centric. It seems to me there should be an easy and obvious way have a decorative image with a non-blank alt=.


In my experience, aria-hidden will effectively accomplish the same ends for accessibility purposes. That article mentions using role="presentation" but with the caveat that not all screen readers and such understand that well enough to then not try to start reading the filename.

I guess the question is if SEO crawlers still read alt text for images marked as aria-hidden="true" or not. I have no idea on this one, but I'm very curious about it.

I've been pushing the folks I work with to consider SEO as a second-class citizen within alt text. If you can reasonably use a keyword in a natural, useful way, definitely use it. Otherwise, from what I can tell, an image's alt text doesn't seem to have any greater SEO value than the rest of the content on the page. Write better on-page content with better keyword use, with alt text being informative extra content.

And clarification on when alt text is needed: 1) if the image contains informative content that adds to the surrounding content, but also 2) a linked image where the image is the ONLY thing within the link, in which case the alt text should describe the destination of the link, not the contents of the image. I just recently learned this, but it makes sense when you think about it.


"2) a linked image where the image is the ONLY thing within the link, in which case the alt text should describe the destination of the link, not the contents of the image. I just recently learned this, but it makes sense when you think about it. "

Yeah. Good stuff. Thx.

p.s. Best I can tell most images are decorative. That is, they are there for the visual appeal, to create "white space", etc. It's fairly rarely they actually contain content. Of course, there are exceptions, but in general.


I agree! I work on a marketing team and it’s interesting to hear the conversations about what is and isn’t decorative. Are brand elements decorative? Generally yes, but on a marketing site, aren’t those half the point? At which point does that make them informative?

It can be frustrating to sit in meetings where people go back and forth about this stuff. But at the end of it all, any meeting where people are constructively discussing accessibility is a win for me.




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

Search: