In 2017, I and a small group of colleagues collaborated on a series of accessibility workshops that we delivered as pre-conference sessions at three national conferences, AHEAD, EDUCAUSE, and Accessing Higher Ground. If you were a participant in any of these workshops, you're about to receive a follow-up survey. This blog post documents my quest for an online tool for conducting the survey. My #1 criterion for choosing a tool is whether the tool generates accessible output. My #2 criterion is whether the tool is accessible to survey authors with disabilities, but I didn't specifically evaluate that for this blog post.
To keep things simple, I tested only one question type: Multiple choice with radio buttons.
The first question on my survey is this: "Where did you attend our accessibility workshop?" There are three possible answers: Accessing Higher Ground, AHEAD, and EDUCAUSE. Users are required to select one of the answers.
For this to be fully accessible to screen reader users, the following information should be communicated via their screen reader:
- Each answer
- The question
- That the field is required
- The current state of each radio button ("checked" or "not checked")
- The number of options, and the user's position within those options (e.g., "2 of 3")
If I were to hand-code the survey from scratch using standard HTML markup, my code would look something like this:
Here again are the five requirements for full accessibility, with a brief explanation of how each is attained using the above markup.
1. Each answer
The label associated with each radio button (e.g., "Accessing Higher Ground") has a <label> element with a for attribute, the value of which matches the id of the radio button <input> element. This explicitly associates the label with its matching radio button. Screen readers announce the matching label when a radio button has focus, and mouse users and touch screen users can click or tap anywhere on the label to select that button (more convenient since it's a larger target than the button alone).
2. The question
Web developers often make the answers accessible, but often overlook the question. And users should never answer "Yes" if they don't know what they're agreeing to! The standard method for making the question accessible is to wrap the question in a <legend> element, then wrap that plus the group of radio buttons inside a <fieldset>. With this markup, screen readers announce both legend and label when a radio button receives focus. They differ in their implementation of this. Some screen readers announce both the legend and label for each button as the user navigates between the buttons; other screen readers announce the legend only once (when the first button in the group receives focus). They assume that's enough, and on subsequent buttons they just announce that button's label.
3. That the field is required
The required attribute was introduced in HTML5. The proper technique for using it with radio buttons is described in the HTML 5.2 spec, Example 22.
To paraphrase: It's only required on one of the radio buttons in the group, but authors are encouraged to add it to all radio buttons in the group to avoid confusion.
4. The current state
If the radio button is correctly coded as a radio button, all screen readers automatically announce whether the current radio button is "checked" or "not checked".
5. Position within the Total
If the group of radio buttons is coded correctly, all screen readers will announce something like "2 of 3". One exceptions is JAWS in Internet Explorer 11, but this is probably an IE issue, as JAWS does announce this information in Firefox (tested using JAWS 2018).
How Screen Readers Render Standard HTML
Putting all the pieces together, screen readers typically announce the following information when the first radio button in a group receives focus:
- What this is, i.e., "Radio button"
- The label for the button
- The question (e.g., legend)
- The current state ("checked" or "not checked")
- Position within the total (e.g., "1 of 3")
Screen readers vary on the sequence of these items. Also, as noted above, screen readers vary on whether they continue to announce the legend for each button as the user navigates through their choices.
I created a simple survey with one required question using the following tools:
- Survey Monkey
- Google Forms
- Survey Gizmo
Then I tested the output with keyboard alone, NVDA 2017.4 in Firefox 57, JAWS 2018 in Firefox 57 and Internet Explorer 11, VoiceOver in Safari on MacOS Sierra, and VoiceOver in Safari on iOS 11 (using an iPhone X).
The following sections show the code generated by each of the survey tools, edited to just show the relevant markup for accessibility. All tools add a lot of extra <div> and <span> elements plus class attributes to help with styling, but these have little or no impact on accessibility and have been removed here for readability. Also, each of the tools auto-generates name and id attributes - I've edited all those so they match my original example.Continue reading