Live data from Hacker News

Aria-label is a code smell

ericwbailey.website

71–74 of 74 posts

Re: Aria-label is a code smell

#71

Earlier quoted context omitted.

Adding an empty alt tag is often the correct thing yes. Rule of thumb: if someone read the page out to you, would you prefer if they read that alt tag you are thinking of adding or not?

I wish omitting alt text was the equivalent of empty alt text. Nothing else works this way. If a page doesn't have a favicon, you don't add an empty icon href. I know empty alt text is preferred because otherwise, screen readers will usually revert to reading the file name. But I wish screen readers didn't do that.

> If a page doesn't have a favicon, you don't add an empty icon href.

You can though — it prevents a 404 error being logged in the browser console.

e.g.

Re: Aria-label is a code smell

#72

Earlier quoted context omitted.

I always thought it was standardized that way in an effort to get people to care about accessibility. But FWIK it might just be because someone on the standards committee wanted it that way.

Does that work though? If you don't care about accessibility, you can still leave out the tags. Screen readers will then default to reading the file name, which I'd argue is worse than skipping over images in the general case.

It probably worked better when everyone validated their pages and (I think) html quality used to be a ranking factor in Google.

Re: Aria-label is a code smell

#73
post #68
post #40

Earlier quoted context omitted.

For those reading: using avatar as the alt text or aria-label is also wrong. At minimum it should say whose avatar it is but the ideal scenario is a description of what is in the image. The point of alt text is to make it accessible to everyone (slow connection, visually impaired, etc). Close your eyes and think "avatar" - not very useful, a better example is "Me in front of a lake showing off a fish I just caught."

"avatar" is fine in a test.

Yep, agreed

Re: Aria-label is a code smell

#74

Earlier quoted context omitted.

>what, these are exactly the sites where you need aria tags, because they all have buttons and workflows the context and usage of which are totally obvious to anyone who can see and completely opaque otherwise. The authors point was that you should rely first on the information you can communicate in the actual content, ie, a button with the content of 'submit', when it's inside a form element, is enough to communica…

have you used a screen reader? If so have you ever used the more advanced navigational methods, here I'll just limit myself to the web-rotor on Voiceover because it is the easiest to think about and to remember how it works - at least for me. >The authors point was that you should rely first on the information you can communicate in the actual content, ie, a button with the content of 'submit', I understand the autho…

I found this example helpful.
Post reply on HN