Example 9 - The Answer is 42, But What is the Question - Fieldset and Legend on iOS Devices

Summary

On versions of iOS (prior to 9.0), the legend element within a fieldset was completely hidden from VoiceOver users. Users were unable to swipe to it, and it was not announced along with the other form elements in the fieldset. After the iOS 9.0 upgrade users can swipe to the legend and hear it, but when they swipe to the form controls in the fieldset the legend is still not read to them in context.

Examples

Please review the following on your iOS device.

What is your least favorite number?

Explanation

The purpose of the legend tag within a fieldset element is to programmatically tie its contents (which can be a question or common label) to individual controls in the fieldset. Assistive technologies, such as screen readers, can use this programmatic information to announce the legend text along with individual form field labels, or at least make it available to the user when the focus is on an element inside the fieldset.

Imagine someone stopping you on the street and asking you to choose an answer without telling you what the question is. That is essentially what happens if your screen reader does not announce the legend element in a fieldset. In our example the legend contains the question "what is your least favorite number?".

With VoiceOver in iOS prior to the 9.0 upgrade, users were unable to locate the legend element in a fieldset. No matter what the user tried, nothing would work. The legend was not announced with individual form fields in a fieldset. Users tried to locate the legend by swiping to the beginning of the fieldset or smudging their screens with their tear soaked fingers using "explore by touch", to no avail.

In more recent versions of iOS the problem has gone from critical to merely bad. Users are now able to locate their legends by swiping or explore by touch, but a legend is still not read in the context of the fieldset form controls. Windows based screen readers read the legend in the context of the first form field in the fieldset. Most of them can be configured to read it for every form control in the fieldset if desired.

The developer could perform hacks to address this problem. For example, the developer could repeat the legend text in labels for individual form fields in the fieldset, or use aria-describedby to associate the legend with individual form fields. But this would cause the legend content to be announced repeatedly in screen readers that support the fieldset/legend construct.

Imagine...

You are creating a set of multiple choice questions as part of an online voting system. You put the questions (such as "which person do you vote for as the mayer" or "which of these people are not desired, and should be retired or fired") using the legend tag and the candidate names as radiobuttons or checkboxes. You realize that blind voters are likely to use online voting with a screen reader, and that many of them are likely to use VoiceOver on mobile devices.

So...

Whose Line Is It Anyway?