WebAIM: Creating Accessible Forms – Accessible Form Controls

Creating Accessible Forms
Accessible Form Controls

Article Contents

  • Page 1: General Form Accessibility
  • Current page: Page 2: Accessible Form Controls
  • Text Inputs
  • Textareas
  • Checkboxes
  • Radio Buttons
  • Other Input Types
  • Select Menus
  • Buttons
  • Image Buttons
  • JavaScript Jump Menus
  • Important Attributes
  • Autocomplete
  • Required Fields
  • aria-invalid
  • Page 3: Advanced Form Labeling
  • Text Inputs

    Name:

    <label for=”name”>Name:</label>
    <input id=”name” type=”text” autocomplete=”name”>

    Matching for and id values associate the label with its form control. Because id attribute values must be unique on each page, a form control can only have one associated <label>.

    Note

    Another benefit of labels is that the user can click on the label to set focus to the form control. This is useful on small screens and to some people with motor disabilities, particularly when targeting small checkboxes and radio buttons.

    Clicking on labels is also an easy way to check for proper form labeling. If clicking the label sets focus to or activates the form control, then that label is programmatically associated.

    Text Areas

    Enter your address:

    <label for=”address”>Enter your address:</label><br>
    <textarea id=”address” autocomplete=”street-address”></textarea>

    Checkboxes

    Select your pizza toppings: Ham
    Pepperoni
    Mushrooms
    Olives

    <fieldset>
    <legend>Select your pizza toppings:</legend>
    <input id=”ham” type=”checkbox” name=”toppings” value=”ham”>
    <label for=”ham”>Ham</label><br>
    <input id=”pepperoni” type=”checkbox” name=”toppings” value=”pepperoni”>
    <label for=”pepperoni”>Pepperoni</label><br>
    <input id=”mushrooms” type=”checkbox” name=”toppings” value=”mushrooms”>
    <label for=”mushrooms”>Mushrooms</label><br>
    <input id=”olives” type=”checkbox” [...]

    Read article at webaim.org

    Article Taxonomies

    Categories:
    Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in /home/webable/www/www/wp-content/themes/webable/content-mcm.php:65 Stack trace: #0 /home/webable/www/www/wp-includes/template.php(812): require() #1 /home/webable/www/www/wp-includes/template.php(745): load_template('/home/webable/w...', false, Array) #2 /home/webable/www/www/wp-includes/general-template.php(206): locate_template(Array, true, false, Array) #3 /home/webable/www/www/wp-content/themes/webable/single-mcm_article.php(15): get_template_part('content-mcm') #4 /home/webable/www/www/wp-includes/template-loader.php(106): include('/home/webable/w...') #5 /home/webable/www/www/wp-blog-header.php(19): require_once('/home/webable/w...') #6 /home/webable/www/www/index.php(17): require('/home/webable/w...') #7 {main} thrown in /home/webable/www/www/wp-content/themes/webable/content-mcm.php on line 65