Creating Accessible Forms
- 1 Overview
- 2 Slides
- 3 Text Transcript
- 3.1 Agenda
- 3.2 About Deque
- 3.3 About Me
- 3.4 Setting the context – Forms
- 3.5 Basics – Associated Labels
- 3.6 Basics: Group level form controls
- 3.7 Basics: Labels and instructions
- 3.8 Dealing with Dynamic and Complex Forms
- 3.9 Error handling and prevention
- 3.10 WCAG 2.0 Success Criteria that are related to Forms
- 3.11 Resources
- 3.12 Share This:
- 3.13 Related
This has been presented as 4th Learning Session to the members and guests of W3C Accessibility in India Community Group. Objective of these learning sessions is to raise awareness about accessibility and enhance network of accessibility professionals.
Below are the slides presented in the session:
Hello everyone, Thank you for joining us. In this session, we will be talking about Creating Accessible forms. Agenda of this session will be:
- About Deque and Me
- Setting the Context – Forms
- Remembering Basics
- Associated Labels
- Group Level Form Controls
- Labels and Instructions
- Making Dynamic and Complex Forms accessible
- Error handling and prevention
- WCAG 2.0 Success Criteria related to forms
Deque is a global leader in the area of Accessibility serving Government, Corporate and other organizations for 15+ years. Digital Accessibility is both our mission and vision.
Am an accessibility evangelist with a decade+ of experience. Started my accessibility journey at BarrierBreak, then worked at several organizations including Yahoo!, PayPal, HCL Technologies and currently works at Deque. Accessibility is not just my profession but something very close to my heart. My hobbies include networking, swimming, playing Chess and Carrom. Currently I live in Hyderabad with my wife Hema and our cute daughter Khushi Varshini.
Setting the context – Forms
Today digital forms are playing a key role in people lives. They are everywhere from school admission to avail retirement benefits. It’s encouraging to see even Government is promoting use of digital services. Moving to digital would be an added benefit to people with disabilities and make them less dependent. They are also safe and secure way to store and easy to retrieve.
Basics – Associated Labels
It’s essential that all form controls are programmatically associated with their respective labels. This can be achieved by using <for> and <id> attributes, <aria-label> or <title> attribute.
References for Associated Labels:
- W3C – WAI’s tutorial on Form labels
- Technique H44: Using Label elements to associate text labels with form controls
- Technique G131: Providing Descriptive Labels
Basics: Group level form controls
When user has to select options that are provided in the form of radio buttons, checkboxes or when there are a group of form controls such as Date of birth, phone number; those controls usually have a common label. In such a situation, it’s essential to ensure that:
- All form controls are programmatically associated with their labels
- All form controls are programmatically associated with their common label
References for Group level form controls
- Technique H71: Providing a description for groups of form controls using fieldset and legend elements
Basics: Labels and instructions
It’s recommended that forms labels are visible. Now-a-days, placeholder text is used as form label; but this is not a good practice unless there is a mechanism to make label still visible even when user has inserted data into input field. Otherwise, it would be difficult for several users including those with cognitive disabilities to review the information before submitting.
It’s also important to provide instructions about required fields, if input field accepts data only in specific format or any other information that user should know while filling out the form.
Resources for Labels and instructions
Dealing with Dynamic and Complex Forms
I’m going to demonstrate you all 3 examples:
- Creating Accessible Date Picker where the date picker is completely accessible using keyboard and not with mouse alone, all dates have descriptive labels for user to select
- Now-a-days, e-Commerce is trending and often the challenge is to deal with Shopping cart. Shopping carts usually gets updated dynamically as user makes selection of a product. So it’s essential that user gets the updated information about pricing, quantity added, total number of products in the cart etc., So let’s look at an Example of Accessible Shopping Cart <aria-live> tribute plays a key role to make such applications accessible.
- Another interesting widget would be Character count. We see several applications will have <texture> input field that allows only a limited number of characters can be inserted. In this case, user should be informed about permitted number of characters along with the <label> and alert user when nearing to end of allowed number of characters. It’ would be annoying to to expose character count right from first character. View Example of an Accessible Character Counter
Error handling and prevention
It’s important that there is a mechanism to identify mistakes that user has made on form submission. It’s also important error messages are conveyed via multiple clues including through text and styling input fields that requires correction.
It’s essential to enable users to prefer from making mistakes. To address this, user should be provided helpful information along with form label for potential fields that require user to input in specific format. For instance, Date of birth field accepts in a specific format or in a user registration form, password field may have some conditions. These need to be informed to user.
Resources for Error handling and prevention
- 1.3.1 Info and Relationships: Information, Structure and relationships conveyed through presentation can be programmatically determined or are available in text (Level A)
- Associate labels either explicitly or implicitly
- Ensure that group related form controls are marked up using <fieldset> and <legend>
- 2.4.6 Headings and Labels: To describe topic / purpose (Level AA)
- Provide descriptive labels
- Provide visible labels
- 3.3.2 Labels or instructions: Labels or instructions are provided when content requires user input (Level A)
- Identifying required field
- Error identification
- Providing instructions
- 4.1.2 Name, Role and Value: For all user interface components (including but not limited to: form elements, links and components generated by scripts), the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set; and notification of changes to these items is available to user agents, including assistive technologies. (Level A)
I have put together some great resources including Code Examples from our Deque University, a nice tutorial from W3C, a couple of articles from WebAIM and my good friend Rakesh.
Thanks everyone for attending and looking forward to see web more inclusive. Do feel free to reach out to me for any questions / comments.