Benjamin Read's code garden.

React Accessibility

Published on

This article is about: javascriptreactaccessibility

Originally published in print for Net Magazine.

In the recent past, I’ve heard React being criticised for not being accessible, or for allowing practices that don’t help developers think about accessibility.

I have to disagree.

Just like any other frontend code, working with React in an accessible way requires some forethought.

One of the common mistakes I’ve seen is that we sometimes put click events on non-semantic elements. It’s true, React makes it very easy to put a click event on any dom element.

I think one of the reasons for this is that with React, our JavaScript is our single source of truth, so we tend to think in JavaScript. One DOM element is like any other DOM element, and they all can be manipulated in much the same way.

However, if we’re thinking about accessibility, we’re committing ourselves before we start coding, that we’re going to do things the right way, including using semantic elements. If we do this, we’ll ensure we assign a click event to a semantic element to start with - a 

Read more articles about: javascriptreactaccessibility


No comments yet. Be the first to comment!

“Wisest are they who know they do not know.”

— Jostein Gaarder