Live data from Hacker News

Aria-label is a code smell

ericwbailey.website

21–30 of 74 posts

Re: Aria-label is a code smell

#21

Earlier quoted context omitted.

> They're not saying that using area-* cannot be correct, just that it's so often incorrect as to be a smell. But do to accessibility correctly you almost ALWAYS need to use aria-* So it this is just like saying "writing code is a code smell because you'll have bugs" and it turns "code smell" into a useless tautology.

> But do to accessibility correctly you almost ALWAYS need to use aria-* What? No... Screen readers do best with standard elements and you're supposed to avoid aria labels where possible, and only as a last resort.

> What? No... Screen readers do best with standard elements and you're supposed to avoid aria labels where possible, and only as a last resort.

Yes, you should avoid overusing them, which is the point the author is turning into a "code smell", but I've no idea how the heck you would pass an AAA or even a AA audit without aria-* labels.

Can you point me to a significant site, i.e. one that's not just a simple content site, that doesn't use aria-* tags at all?

Re: Aria-label is a code smell

#22

Earlier quoted context omitted.

> But do to accessibility correctly you almost ALWAYS need to use aria-* What? No... Screen readers do best with standard elements and you're supposed to avoid aria labels where possible, and only as a last resort.

> What? No... Screen readers do best with standard elements and you're supposed to avoid aria labels where possible, and only as a last resort. Yes, you should avoid overusing them, which is the point the author is turning into a "code smell", but I've no idea how the heck you would pass an AAA or even a AA audit without aria-* labels. Can you point me to a significant site, i.e. one that's not just a simple content…

Why do you elevate "significance"? In terms of the number of developers who care, "significant sites" are a minor niche. The web obeys a power law; there are only 1000 "significant" websites in the world, and far more "insignificant" ones.

Most of the world's web developers are creating blogs, business-card-ware (e.g. restaurant websites that let you see the menu as a PDF but don't let you order from it), and HTML-based CRUD UIs for backoffice software (i.e. the thing you get from bog-standard no-other-libraries-needed Django or Rails.) You don't need the aria- tag attributes when building any of those. To achieve accessibility with these, you just need a ca. 2001 CSS Zen Garden-esque understanding of semantic HTML.

Re: Aria-label is a code smell

#23

Man talk about smell, there are like 18 olfactory cultural dimensions on display in this passage, esp. comparing para 2 as a prologue to para 1. > In my experience, the term code smell usually has a negative connotation when someone mentions it. > It’s a lot like a noticeable smell emanating from the office refrigerator. Ideally it’s some delicious homemade kimchi someone brought in, but more often than not it’s some…

Ah yes, forgotten fish sticks - a common occurrence we can all relate to as a metaphor for questionable code.

Re: Aria-label is a code smell

#24
Did the term originate from Martin Fowler? Excerpt

> smells don't always indicate a problem

That's a poorly coined term then, if you're having to immediately clarify that it doesn't mean what its common meaning indicates.

Re: Aria-label is a code smell

#25

Did the term originate from Martin Fowler? Excerpt > smells don't always indicate a problem That's a poorly coined term then, if you're having to immediately clarify that it doesn't mean what its common meaning indicates.

Google snippet when searching for "code smell martin fowler":

"According to Martin Fowler, code smells are not problematic on their own. They are warning signals that there might be a real problem in the code. For example, long functions are considered a code smell, but not all long functions are necessarily bad or poorly designed. Fowler suggests that junior members of a development team identify code smells and review them together with senior members, who can evaluate if there is really a deeper problem in the code."

https://www.sealights.io/code-quality/the-problem-of-code-sm...

And the first google result, which is Martin Fowler's own website:

"The second is that smells don't always indicate a problem. Some long methods are just fine. You have to look deeper to see if there is an underlying problem there - smells aren't inherently bad on their own - they are often an indicator of a problem rather than the problem themselves."

https://martinfowler.com/bliki/CodeSmell.html

Re: Aria-label is a code smell

#26
post #3

This page is impossible to read on smartphone at least. There are kilometers of empty space between each line and blocks. And the font is huge. There is 20 lines of a few words each at most per page of scroll. I have now pain in my finger scrolling so much to try to see what is the point. Also a lot of useless speech and I have not reached the point of why aria label is code smell before giving up...

> a lot of useless speech and I have not reached the point of why aria label is code smell before giving up...

This was the problem, rather than the font size. Lede buried under 2000 words of generic intro

Re: Aria-label is a code smell

#28
post #12

The article claims that aria-label is only intended to be used on interactive elements. This surprised me, so I looked into it. The ARIA spec says aria-label can used with any roles, with no mention of being reserved for interactive elements. https://www.w3.org/TR/wai-aria-1.1/#aria-label Also, maybe I am too jaded by working at orgs that don't care about a11y, but any indication that any amount of thought has been p…

> any indication that any amount of thought has been put into a11y issues is the opposite of a code smell to me

You're absolutely right but that's mainly just because the bar is so low.

Ultimately it does seem like code smell to me. Insofar as it indicates you're doing something toward a11y, it's what I'd call a "good problem" (the type you only encounter when things are going in the right direction), but it seems a good indicator that a11y is being applied as an addon process (where a functional product goes through a11y review before iterating) rather than an intrinsic consideration at the architecting stage.

Re: Aria-label is a code smell

#29
post #27

Learning how to use a screen reader in order to test the a11y of my code has been on my todo for a very long time. Has anyone else done this? Is it worth it?

Absolutely worth it. Has helped me a lot, finding small issues like buttons with no meaningful label or custom checkboxes that don't announce their state.

I don't know what platform you're on, but I use VoiceOver on Mac. My blind relative uses JAWS on Windows.

Re: Aria-label is a code smell

#30
post #27

Learning how to use a screen reader in order to test the a11y of my code has been on my todo for a very long time. Has anyone else done this? Is it worth it?

There's no "learn how to use," just enable it on your existing devices. Settings > Accessibility on android, at least.

Consider making a habit of using it when you are circumstantially visually disabled: in bright sunlight, while you can't be physically present at the phone (eg while doing dishes or folding laundry), etc.

Post reply on HN