Web App Accessibility (feat. React)

Testing Overview, Linters & Dev Tools

Marcy Sutton Todd

Marcy Sutton Todd

Principle Studios
Web App Accessibility (feat. React)

Check out a free preview of the full Web App Accessibility (feat. React) course

The "Testing Overview, Linters & Dev Tools" Lesson is part of the full, Web App Accessibility (feat. React) course featured in this preview video. Here's what you'd learn in this lesson:

Marcy outlines some basic steps for testing accessibility. For example, can the Tab key navigate through a page and reach every navigation item? Also, ensuring layouts flow well when content is zoomed or using DevTools extensions like Axe can be easy ways to get started.


Transcript from the "Testing Overview, Linters & Dev Tools" Lesson

>> So some screen reader stuff, you can dive way deep in this obviously, we just scratched the surface. What I really want you to know, kind of going forward, are some tips for debugging. So screen reading might be one aspect of debugging. So debugging, you could also call web accessibility testing.

It's something all devs should do. It's regular automated testing or learning concepts about security or performance. I think accessibility is even more foundational than some of those things because of the direct impact on how our user interfaces affect people's lives. I guess yeah, all of these concerns are important.

But I think accessibility testing should be part of your regular workflow. And once you get in the habit of opening up the tools, testing it, hopefully, it will just lodge in your mind like it has for me so that it just becomes a matter of habit of, okay, I'm going to test with the keyboard.

Okay, I'm going to test with the axe extension. So that's the first step I take is, I use my tab key to navigate through a page. It's as simple as it sounds. You hit tab and tab through things you see, can I reach and navigate? Or reach and operate every interactive control on a page.

So if a mouse user can click on it, as a keyboard user, I should be able to do the same task. It might not be the exact same element, I might have a click event on a wrapper element or something that only mouse users use, but then within that, I have a focusable link, or a button, or some other way to do the same thing.

So I wanna be able to accomplish every task as a keyboard user. And if you ditch your mouse completely, like just don't use it for a day, maybe you could put some paper over your trackpad or it seems a bit extreme, but you know what I'm saying? If you can have a process where you cannot bail out and use your mouse, you're probably gonna find some issues that need to get fixed.

Yeah, because it's pervasive, but it's something we can address and a lot of cases. So can you reach and operate every control? Can you see where you are on the screen? Is there a focus outline? We have the default blue. I will say the slide materials that we have right now, the whole sidebar is a series of components that I really want to contribute back to.

It's not exactly how I want the keyboard accessibility to be. So sometimes you have to go open up an issue or a pull request on an open source library and say, hey, can we make this configurable or can I just contribute a fix for this? That's probably what I'll do.

Because when these menus over here on the left are closed, we should be able to skip by them, it's It's actually forcing me through every single link in the sidebar, which can get tedious. As a sided user, I can skip by those sections cuz they're collapsed. But as a keyboard user, it's opening them to try and be helpful, but it ends up being kinda annoying.

[LAUGH] So that's why we have to test it. So I'm just trying to get through here, some skip links could be helpful too. If I could skip past this sidebar, I think that's a feature that I'd like to add to this. So I've got a little theme picker on the bottom left of the screen so I can get between dark mode and light mode.

If I hit enter on that, it opens up a little dark Light mode, dark mode picker. And it said focus to that, so it opened that interactive widget. And then I can use my arrow keys to go through these items, that's pretty slick. Can I hit the Esc key?

Yes, I can, so Esc took me back to the button that prompted that to open. And then I can skip on by, I can get to all of the interactive things on the page. Something you don't want to have happen is you don't wanna get stuck behind any layers.

If there's a modal dialog, we wanna send focus into it and replace it when it's done, and I shouldn't get stuck back there. Cuz mouse users aren't stuck back there, they can mouse around and do things. But keyboard and screen reader users are often literally left behind. [LAUGH] So we can avoid that with some focus management.

And can I use other common key commands like Esc or the arrow keys or the space key? So we tested with the Tab key. The next thing that I would do is open a browser dev tools extension like Axe for Chrome or Firefox or Edge, and we'll do all of these steps in a minute.

I also zoom the page to at least 200% on my Mac keyboard, that is Command Plus, and I can zoom weigh in. It conveniently mimics my responsive breakpoints and stuff. So anything you do for responsive design will work for zoom and magnification, something we call reflow which is very awesome.

That that just works together. So I can zoom back out with Command minus, I think it's control plus, control minus on the Windows keyboard. So by zooming in regularly, you can see, do the layouts, reflow. Are there any components that are straight up broken, like interactive things are happening off screen, or you have horizontal scrolling where you shouldn't?

And that is so that people who are low vision, who zoom way in, can still navigate. And there's some exceptions, as we'll talk about a little bit later, like some interfaces are just going to have horizontal scrolling and there are exceptions. But for the most part, it should be responsive and reflow these days.

We wanna test other visual modes. So like on this site, I have light mode and dark mode. I had to fix a few things, I think in light mode, it didn't look great, but in dark mode, it was great. So I just had to add some CSS for that.

I have running a screen reader, is pretty far down the list. So it's It's not the first thing, conceptually, we wanna know about it, but it isn't in my even top three things of how I test. But when you do, because you should, pull up those cheat sheets for whichever screen reader you're testing.

Double check before filing an issue on Jira, maybe get another opinion or you can work with people who use screen readers regularly as well, and that's very important. We shouldn't just guess, we have all these biases, we're new to screen readers, we can see the screen. If you can work with people who use screen readers and pay them for their time, that's gonna yield way better results.

So whenever you can do that, you should. And then kinda just to make sure we don't miss this, for media content like audio or video, make sure that there are transcripts and/or captions. And make sure your media players can accommodate that content. So these steps could apply to any website or web application.

I got a great question, just like random email question, about someone who was curious about the accessibility of Microsoft 365. Just like randomly asked me that question, and I thought, that's a good question because people are evaluating. Tools to use and they wanna know how accessible it is, and so these techniques would apply to that.

It's cloud-based web software, it needs to be accessible. So these techniques are things that I would use to evaluate that if I were looking to procure a tool for HR or anything. And fortunately, there are some sort of crowd-sourced feedback on accessible platforms you could search for Microsoft 365 accessibility.

Microsoft might even have some of their own documentation on it, but just to kind of make drive home that like anything that's It`s web-based, can be tested with these techniques for the most part. So those are the steps, and we will use these steps in a little bit.

So Linters and DevTools, there's a ton of different tools that you can use, different browsers have built-in browser Devtools that are excellent these days. Chrome is my choice that I reach for all the time. I know sometimes the Chrome and their practices, Google, is not people's preferred browser.

So some people use Firefox, and there are awesome tools in Firefox now. Their color picker is amazing, it can help you identify the contrast ratio of different elements. That's one of my favorites, great layout tools as well in Firefox. Safari also has awesome tools, they're kind of forgotten about, but there's some accessibility inspector things and audit feature, the responsive design mode in Safari.

It's pretty excellent as well, built into Chrome is Lighthouse. It is an accessibility auditing tool built into the browser. It runs the Axe-Core JavaScript library and then we get into browser extensions. So within the browser, my number one, my daily driver is the Axe Chrome extension. It's by Deque, I used to work on that, so I am a little biased, but it's just solid, It's an awesome tool.

You can check how a page looks at runtime. And then if you have things like modals or other components, you could run it again and make sure it didn't miss anything. And we'll test it out to see things like, what labels are on the issues, are they best practices, or are they actually tied to violations in the Web content accessibility guidelines.

That's kinda good things to pay attention to. You can go straight from the results in that extension over to highlight elements and look at them in the Devtools, we'll check that out. And then there's kind of upsell tools within the extension if you wanna expand into tools that your organization pays for, they put a lot of effort into those.

Another tool we're checking out is Accessibility Insights for Web from Microsoft. It also uses the Axe-core library, or sort of see that come up again and again. It's an awesome tool, should definitely checked that one out. The Web developer toolbar for Firebox and Chrome, I'm gonna pull that one up as well, it's pretty awesome.

It's really the best tool I found for looking at heading structure. So we could install that one, and then when it comes to linting for ESLint and text editors, there is one for React applications called ESlint-Plugin-JSX-A11y, sort of a standard ESlint plugin. There's another one from Deque called Axe Linter.

I used it a while back, haven't used it super recently, but it could be an option for projects that aren't JSX or React-based. One thing I will say about linters is, you might need to tweak the settings. Sometimes they have rules that just come up again and again.

And if you ignore them because they don't apply to your situation or it's just kinda guessing wrong, you can turn that rule off. You don't wanna have the team kinda get used to ignoring results. It's better to fine-tune the tools [LAUGH] so that they're relevant, and then if something comes up, you actually pay attention.

Kind of a similar theme with automated testing as well.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now