Hacker News new | ask | show | jobs
by Ensorceled 1320 days ago
A "code smell" is supposed to be something that is a warning sign that there are other probable issues and you should look deeper. Using aria-* incorrectly is an actual problem, not a hint that there may be deeper issues.

It's always annoying when an article begins with a strained attempt to redefine well known terms.

3 comments

It feels like you didn't read the article I read.

THIS article defines "code smell" exactly as you did. And it says that using aria-* incorrectly is not a smell, but an error, exactly as you did.

The claim of the article is that using aria-* at all is a code smell, in exactly the sense you said. They list a number of possible problems, and suggest alternatives. They're not saying that using area-* cannot be correct, just that it's so often incorrect as to be a smell.

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

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.

The vagaries of English being what they are significant does not need mean important, in this case I think they mean a site with a significant amount of work behind it. That is to say not a quick resume site. A real site with a few 100 pages and complicated workflows are significant in the way I believe the OP meant.

>You don't need the aria- tag attributes when building any of those.

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.

Even IF in one of these sites they order of your markup is such that the elements follow in a correct order and the seen text will be understandable when accessed through the screen reader there are likely to be instances in which, if you care about the experience of a visually challenged user, extra work would be useful to allow for navigating between parts of the site in an understandable way and to do things with a reasonable speed.

So, no examples?
I work daily on a pretty complex platform that is able to completely bypass them. That’s because Vue, and I imagine other UI frameworks like it, have good support for building components by essentially decorating these simple HTML elements that the screen readers like.

In other words, for example, your dropdown can be a <select> and Vue can still do automagic with it, it doesn’t have to be a pseudo-dropdown built from <div>s that you then need aria for. And in fact even in our complex codebase that’s been universally true.

I’m sure there are exceptions but I assume they’re rare enough that even other large projects don’t have any.

What is the minimum amount of functionality that, in your opinion, would 'elevate' a site beyond 'simple content' territory?
So, no examples?
Only if you want to give your users a terrible experience where the screen reader reads a bunch of separate items with no logical connection between them.

A single aria-label describing a component and its actions is always going to be better.

Exactly. I made a large site AODA compliant and, yes, I could have done it without aria-* but it would have been a really shitty UX.
They're not saying all aria- attributes are a code smell, just that aria-label is. And they provided an extensive list of common usages where an alternative would usually be better.
"The more ARIA attributes that were present, the more detected accessibility errors could be expected"

This sounds about right for the current state of attention paid to assistive technology. Which is to say, it's an afterthought at best. Buying or installing some half-baked framework which attempts to use it correctly without even determining if it's correct or not and calling it good seems about as far as anyone will take it. One could make an analogy with left-pad: easy to use, but turns out it does the wrong thing for several cases.

Using anything incorrectly is probably a problem. What makes a smell is that using it at all is worth scrutiny. Things like eval and interpolating user input can be done correctly but frequently aren't and that's why we have lint rules and names like dangerouslySetInnerHtml
I am not sure I fully agree, opening up a old website and smashing a bunch of aria-* tags does not fix anything. It just adds a bunch of aria-* stuff that may or may not be used.

To correctly implement accessibility on a website can require a fair amount of redoing components so they are properly accessible.