[Draft] Module 5: Forms
Introduction
Courses based on this module:
- Explore how some users interact with form field elements.
- Provide strategies to
- Label and group form controls.
- Include instructions for users to complete form fields in the expected way.
Learning Outcomes for Module
Students should be able to:
- Understand how some users navigate, fill in, and perceive information from form fields.
- Label controls so that they can be identified by users and assistive technologies.
- Group form controls that share a common purpose.
- Provide instructions so that users know how to complete the form.
- Notify users of errors or successes during and after form completion.
Competencies
Skills required for this module.
Students:
- Basic understanding of:
- Accessibility concepts and terminology.
- How people with disabilities use the Web.
- Experience with:
- HTML
input
elements. - WAI-ARIA live regions.
- CSS properties.
- Scripts for custom client validation.
- HTML
Instructors:
- In-depth knowledge of:
- How people with disabilities use the Web (including assistive technologies and adaptive strategies).
- The links between components of web accessibility.
- Accessibility principles.
- The W3C accessibility standards.
- Scripts for custom client validation.
- Experience with:
- HTML
input
elements. - CSS properties.
- HTML
Topics to Teach
Optional topics to achieve the learning outcomes.
Topic: Interacting with Forms
Introduce several strategies for some user groups to navigate, understand, and fill in form fields.
Learning Outcomes for Topic
Students should be able to:
- Understand the following user strategies to interact with form fields:
- The tab key or specific keystrokes to move from one form field to the other.
- Larger targets to interact with form fields.
- Consistent identification and instructions to understand form fields’ purpose.
Teaching Ideas for Topic
Optional ideas to teach the learning outcomes:
- Demonstrate how a set of form elements can be navigated using the keyboard only. Use the tab key to move through different form elements. Use the arrow keys to select options from combo boxes or lists.
- Demonstrate use of the tab key together with a screen reader to complete a set of form elements. Emphasize that screen reader users may only detect information present in the form labels as they are navigating in focus mode. Provide examples of dedicated screen reader keystrokes that they can use to navigate to specific types of form controls, such as e for edit boxes, x for check boxes, or a for radio buttons.
- Demonstrate how users with mobility impairments or low vision users can click the label element to activate a specific form control if both are associated with each other.
- Refer to common pitfalls when completing form elements. For example, in which format a date should be entered or how a phone number should be written. Explain that instructions to complete form fields are essential for users with cognitive disabilities and benefit all users.
Ideas to Assess Knowledge for Topic
Optional ideas to support assessment.
- Practice — Students are asked to complete a set of form fields using the keyboard only and a screen reader. Assess students use of the tab and arrow keys and understanding of key combinations of screen readers to move to specific types of form controls.
- Practice — Students interact with a set of form fields and make sure they can click their labels to activate them. Assess how students understand the relevance of proper click targets for users with mobility impairments.
Topic: Identifying Form Fields
Present strategies to label form controls and make them understandable.
Learning Outcomes for Topic
Students should be able to:
- Label form fields with the
label
element. - Associate labels with input fields with the
for
attribute. - Group several form fields that share the same purpose with the
fieldset
andlegend
elements. - Provide additional instructions with the
title
,aria-label
,aria-labelledby
, andaria-describedby
attributes.
Teaching Ideas
Optional ideas to teach the learning outcomes:
- Introduce the
label
element and provide examples of its usage. Mention that there are explicit and implicit associations. Explain that an implicit association can be achieved by wrapping thelabel
element and its content around the form control. - Introduce explicit associations by means of the
for
attribute. Explain that its value must be a unique id reference of the form control that the label refers to. - Introduce examples of form controls that are related to each other, such as check boxes or radio buttons to select possible answers for a given question. Mention that the
fieldset
element is used to group them all, and that thelegend
element provides the piece of information (label) they share in common. - Introduce additional means to provide labels when it is not possible to use visible text. For example, the
title
, thearia-label
, oraria-labelledby
attributes. Mention that thetitle
may not be well supported by some assistive technologies. Emphasize that contents provided using WAI-ARIA are available for assistive technologies only and are not visible on screen. - Explain that labeling and associating form fields is a WCAG requirement under success criteria 1.3.1 Info and Relationships, 2.4.6 Headings and Labels, and 3.3.2 Labels or Instructions.
Ideas to Assess Knowledge
Optional ideas to support assessment.
- Practice — Students are presented with a group of form controls and are asked to provide a label. Assess how students make use of the
label
element and thefor
attribute, as well as thetitle
,aria-label
, andaria-labelledby
attributes where necessary. - Practice — Students are presented with a set of radio buttons that allow to rate a piece of content based on stars, and a piece of text saying, “Rate this”. Students are asked to properly associate them with their overall label. Assess how students use the
fieldset
andlegend
elements.
Topic: Validating User Input
Present several HTML5 input types and additional techniques that help users enter information in the expected type and format.
Learning Outcomes for Topic
Students should be able to:
- Markup required form fields with text or the
required
attribute. - Validate specific types of data with their corresponding HTML5 input type. For example,
date
,time
,url
, oremail
. - Validate common regular expressions with the
pattern
attribute.
Teaching Ideas
Optional ideas to teach the learning outcomes:
- Indicate that the
required
element denotes that a form control is required. Comment that it is well supported by assistive technologies. Emphasize that it is also good practice to include a textual indicator in the label itself, such as the word “required” or an asterisk (*), so that all users are aware. - Present some common HTML5 elements that help validation and allow users to enter data more reliably.
- Explain that the
pattern
attribute together with regular expressions serve to validate common ways of entering information, such as country codes, phone numbers, or dates. - Explain that these are WCAG requirements under success criteria 1.3.1 Info and Relationships, 2.4.6 Headings and Labels, and 3.3.2 Labels or Instructions.
Ideas to Assess Knowledge for Topic
Optional ideas to support assessment.
- Practice — Students are presented with a set of form fields and are asked to programmatically convey those which are required both visually and programmatically. Assess how students make use of the
required
element and/or some text in the label of the form control. - Practice — Students are presented with a set of edit boxes. Students are asked to choose an HTML5 input type that serves the specific purpose of each of the fields. Assess students’ knowledge of HTML5 form input types.
- Practice — Students are presented with form fields that collect phone numbers of a given country and dates of birth. Students are asked to use the
pattern
element and common regular expressions. Assess how students use thepattern
attribute together with regular expressions to validate the expected input format.
Topic: Notifying Users
Introduce strategies to inform users about successes, errors, or any other warning messages resulting from their input or from a time limit.
Learning Outcomes for Topic
Students should be able to:
- Notify users of existing time limits and provide mechanisms to stop or extend them.
- Provide information about the amount of errors in the main heading of the page, the page title, or via modal dialogs.
- Identify error messages with their corresponding form controls with headings, lists, or anchors.
- Provide inline feedback through messages belonging to specific form controls via labels, icons, or the
aria-describedby
attribute. - Provide instant feedback as the user is typing with
aria-live
regions.
Teaching Ideas for Topic
Optional ideas to teach the learning outcomes:
- Mention that time limits in forms should be avoided to allow users to complete them at their own pace. Explain that when there is a compelling reason to establish the limit, users must be notified in advance and be provided with a way to extend or stop the limit. If the time limit is essential to a valid submission, then there is no need to allow users to extend or stop the limit.
- Introduce the different ways in which errors can be announced after form submission. Explain that a warning message should be included in the title of the page or its main heading, so that all users are aware that their submissions have produced errors.
- Explain that it is good practice to use lists and list items to group error messages. Add that the messages can link to their corresponding form field by using anchors.
- Introduce mechanisms to provide inline error messages for form fields so that users can relate them to its specific field as they move around. Explain that you can use the
label
element to include that information or use thearia-describedby
. - Explain that WAI-ARIA live regions can be used to provide instant feedback as users are typing in a form field or as validation outputs appear so that screen reader users can understand the information provided.
- Explain that these are WCAG requirements under success criteria .
Ideas to Assess Knowledge for Topic
Optional ideas to support assessment.
- Practice — Students are presented with a page where there are form fields visually marked with errors. Students are asked to
- Indicate the presence of these errors in the main heading or title of the page.
- Make textual reference to each erroneous field and group those references in a list.
- Link each list item with its corresponding form field.
- Provide inline instructions in the corresponding form field that users will read once the form field gets focused.
Ideas to Assess Knowledge for Module
Optional ideas to support assessment.
[to be developed]
Teaching Resources
Suggested resources to support your teaching:
- How People with Disabilities Use the Web — Provides stories of people with disabilities using the Web; describes types of disabilities and some of the barriers that people encounter using the Web; and introduces types of assistive technologies and adaptive strategies that some people use.
- Web Accessibility Perspectives (videos) — Is a series of 1-minute videos that demonstrate that web accessibility is essential for people with disabilities and useful for all. They show accessibility features, how they impact people with disabilities, and how they benefit everyone in a variety of situations.
- WAI Web Accessibility Tutorials (Forms) — Shows how to develop web content that is accessible to people with disabilities, and that provides a better user experience for everyone
- WAI-ARIA Authoring Practices ARIA can both cloak and enhance section — provides readers with an understanding of how to use WAI-ARIA to create accessible rich internet applications.
- HTML5 Specification’s 3.2.1 Semantics —
- WCAG Success Criteria 1.3.1 Info and Relationships — Information, structure, and relationships conveyed through presentation can be programmatically determined or are available in text.
- WCAG Success Criteria 2.4.6 Headings and Labels — Headings and labels describe topic or purpose.
- WCAG Success Criteria 3.3.1 Error Identifications: — If an input error is automatically detected, the item that is in error is identified and the error is described to the user in text. (Level A)
- WCAG Success Criteria 3.3.2 Labels or Instructions — If an input error is automatically detected, the item that is in error is identified and the error is described to the user in text.
- WCAG Success Criteria 3.3.4 Error Prevention (Legal, Financial, Data): — For Web pages that cause legal commitments or financial transactions for the user to occur, that modify or delete user-controllable data in data storage systems, or that submit user test responses, at least one of the following is true: Reversible, Checked, Confirmed (Level AA)