Explore keyboard functionality for accessible experiences.
- One of the most important requirements for accessibility is keyboard usage. Why, because this actually affects people with many different types of disabilities. When you make things accessible to use with a keyboard, you make it work for anyone who can't use a mouse. Some people like Maxine have mobility challenges or issues with dexterity. And some people like Mary can't see the screen and need to use a keyboard. You also make it accessible to people that use other assistive technologies like voice recognition software, switches, or other devices.
Remember we don't have those technologies or disabilities represented in our personas, and that's okay. As you learn more, you'll create new personas that represent these functional needs in different ways. Here's the key principle to remember. You must be able to complete all tasks using a keyboard. Must, this is not optional, and it's the very first thing I test when I'm looking at a client's site to see how accessible it is, and it should be the very first thing you look at too. The simplest way to understand it is to look at some examples.
We've got an example here where I'll start to tab through the page using the keyboard and you can see that I can access the things in the navigation. You can see that they're changing as I tab through them. But when I make it to the next part or the main part of the page, you can see that the keyboard skipped over every block of content that's here. I can click on each one of these to select them with the mouse, but it requires the mouse.
There's no keyboard mechanism for me to be able to do this. So as I tab through, you can see the tab focus goes straight from the navigation down to the Request a quote button at the bottom. In this version of the page, we've actually enabled all the keyboard navigation that we need. So as I tab through, I tab through the navigation and I get to the main content and I can use my arrow keys to move between these blocks of content, and I can tab off of that block and onto the Request a quote button.
Let's look at a more complex example. The main functionality on this page is a map, and there's a lot of different controls on it that I can click. I can pan up, pan down, pan left, pan right multiple times. I can recenter the map. I can zoom in, zoom out, and I even have little flags available that tell me some data about each pin on the map when I click on it.
So in order to make sure that we're providing equal functionality for all different users, we need to make sure that all of that functionality is available for somebody using a keyboard. We can do that quite easily by making sure that each one of the controls that we clicked on with the mouse is a simple button. So as I tab through the interface, we'll take the focus down into the map. You can see, as I use the keyboard, each control inside the map takes the focus.
Right now you can see that it's on pan up, and if I hit the Enter key, it pans up. If I hit Tab, I move to pan left, the Enter key will pan left. Hit Tab to center to pan right, to pan down. All of those work with the keyboard. If I continue on, I should get to the zoom in control which I can activate using the keyboard.
I can also zoom out using the keyboard. All of that functionality was equivalent to what is provided for a mouse user. But we've actually gone to the point of making this even a little bit better for a keyboard user. A mouse user has the ability to drag the map and move it fairly easily within the interface. It's not quite that simple to do drag and drop for a keyboard user, but what we have done is enabled some really simple navigation techniques.
So if I tabbed through the interface, you'll see that the map as a whole takes the focus, and you can tell by that big, blue focus outline around it. We've also set this up so that when the map takes the focus, I can use the arrow keys to pan left, pan right, pan up, pan down, and I can use the plus key to zoom in, and the minus key to zoom out.
So as you can see, we've created the exact same functionality for a keyboard user that a mouse user has. The final piece of the puzzle was all of these little pins within the map that have a mouse click on them that show some data about that pin. Unfortunately with Google Maps, there's no way to use the keyboard to get at each of those pins. If I tab through the interface, you'll see that I can go through all of the other components that are there but the focus never gets to those pins themselves.
So in order to make sure that people have access to that data that's in those little callouts that show when we click on the pins, we've replicated all of that information down below the map so that somebody that's a keyboard user can get at it and not have to rely on the mouse. One thing to keep in mind, making sure that we can do everything with the keyboard doesn't mean that we need to be able to tab to all of the content. Some people often misinterpret you need to be able to do everything with the keyboard and make every single paragraph of text on the page tabbable.
That's not the case. Just focus on the function of the interface and carefully think through how you'll accomplish every task with a keyboard. Links, buttons, and form fields are your friends here. They've got all the keyboard access you need built right in. So use those elements and you'll be in good shape. And if you have to create a custom element, try to base it off those simple elements that are already keyboard accessible. The map controls are just button elements. The thumb on the podcast player is just an anchor element.
There's rarely a case where you need to use a div, so stick with simple elements and you'll make things keyboard accessible by default.
- Using color, contrast, and animation in an accessible way
- Making experiences accessible via the keyboard
- Working with touch gestures
- Image and multimedia accessibility
- Form accessibility
- Responsive design and accessibility
- Structuring content