Another accessibility challenge! I like trying to use websites with just a keyboard, which rarely works. The Gold’s Gym class schedule page is no exception. It has so many elements that respond to clicks only that it’s basically useless to a keyboard. I’m going to address the three issues that make this page unusable.
- Week selector
- Day selector
- Class information details
These examples suffer from the same issues:
- Mark up that prevents keyboard focus
- JavaScript that does not include key press functionality
The class schedule defaults to the current week and current day to display information. If you want to look at a different week’s schedule, you have to use the tiny forward and backward arrows next to the week dates.
While each arrow is marked up as <a>
, it does not get keyboard focus because there is no href
attribute.
<a class="display-table-cell text-left" ng-click="vm.changeWeek(-1)"> <i class="material-icons">chevron_left</i> </a>
I solved that issue by adding tabindex="0"
(That’s the recurring theme for this post!)
However, even though the arrows now gain keyboard focus, they do not respond to key presses. Looking at the code I noticed the ng-click
attribute, searched to find that’s AngularJS syntax and found there are others such as ng-keypress
. I tried using that via the Chrome inspector but it didn’t work. There’s probably more to it to support key presses.
Each day of the week has a similar issue. Let’s look at the code:
<div class="border border-thin" ng-click="vm.setSelectedDay(day)">...</div>
The days are not marked up as buttons or links so again, no keyboard focus and they use the ng-click
attribute only. tabindex="0"
to the rescue.
The last major issue is accessing the details of a class. For a mouse user, clicking a class opens a modal window. (Once on the modal window, keyboard tabbing resumes on the parent page but that’s another issue.)
For keyboard users, at this point you’re skipped from the “All instructors” select box, passed all the class details, to a form at the bottom of the page.
The whole class details area is marked up as a table. For a mouse user, an entire table row is a hotspot, not just the word Details.
<tr ng-repeat="scheduledClass in vm.filteredSchedules" ng-click="vm.openClassModal(scheduledClass)" class="ng-scope">...</tr>
tabindex="0"
to the rescue.
All of these could benefit from using the :focus pseudo class to emulate the hover states for better visibility of what’s in focus.
With just a few tweaks, this page would be far more accessible.