A11Y 101: Content flow matters

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Search for a command to run...

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
No comments yet. Be the first to comment.
In this series I'll explore the basics of accessibility and you can join me on this learning trip.
While digging into this accessibility journey, you might have heard me say a couple of times that semantics always win. However, this wasn't always the case. Before HTML5, we didn't have all the fancy semantic elements like header, footer, or main. T...
Most of you know me for my consistency, a golden arrow in my blog series. I've written 1000 articles in 1008 days! Almost an article a day, and my honeymoon was the only holiday I ever took. I'm super proud of this achievement; it has been a fantasti...

It's not the first time I'll be talking about community. I think it's an essential aspect of any successful tool. This shows in my previous explorations of Astro, Medusa, and now Vendure as well. All these products thrive in a super open, welcoming, ...

The cool part about Vendure is how easy it is to set up and how abstract each layer is. Basically, we get the following elements: External database Server Worker Admin UI Frontend While this is amazing, it also brings a bit of complexity when it co...

The previous article looked at customizing Vendure on a data and process level. In this article, we'll look at customizing emails, as they are often a big part of a webshop system. We'll be looking at two different layers of customization for customi...

Even though Vendure is a pretty significant project out of the box, in some cases, we might want to go in and modify some elements to work to our specific use case. In this article, I'll take a high-level look at some elements we can customize within...

I'll be honest with you, I've made this mistake we will look at in this article many times before.
The mistake we are talking about is content flow. In simple terms, which direction does your content flow in?
When we write our code, there is some semantic follow-up.
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
As you can see, these divs are represented in a logical order in the dom. The main thing is screen readers will always read it in this way.
However, with the magical powers of CSS, we can manipulate the order and reverse it.
For example, we could wrap it on the above and apply flex-direction: column-reverse;.
Now the visual user will see the following flow:
4
3
2
1
You might think, alright, but why does that matter? And it gets confusing when we convert these elements into cards and try to use keyboard navigation.

In the video above, we can see the keyboard navigation focusing on the correct flow, but for a visual representation, it's super unclear why the flow we see isn't represented.
You can even try it yourself in this CodePen.
So, while writing this article, I looked at my website and still reversed some visual elements.
Including my mobile article cards, they switch around the image and the title visually. But seeing as they are not separate tab elements, I found no harm in this.
Although, I've reached out to some accessibility experts to get their opinion on it.
My guidance at this point is never to change the focus order from the source order. However, you could make exceptions if it makes better visual sense for elements that don't receive direct focus. (Keep this to a minimum)
Try and navigate through your website. Is the tab order the same as the visual order?
You'll be surprised by how many modern websites the tab order is wrong.
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter