) Influence of form explicit label and implicit label on screen reader users-Update

Source: Internet
Author: User
Explicit label

• Add the for attribute for the label element. The attribute value is consistent with the ID attribute value of the Form Control.

• Reset and submit buttons (<input type = "reset"/>, <input type = "Submit"/>), and image buttons (<input type = "IMG"/>) and the script button (<button> </button>) do not use an explicit label, because they already have an implicit label, such as the value and ALT attribute values, and the content of the button element.

<Label for = "firstname"> First name: </label> <input type = "text" name = "firstname" id = "firstname" tabindex = "1"/>

Implicit label

• According to the HTML 4.01 standard, you can use the label element to wrap Form Controls and label text to create an "implicit label ".

• Some browsers (IE6) do not support implicit label, which is not recommended for wcag2.0.

<Label> First name: <input type = "text" name = "firstname"/> </label>

Another method is the combination of the above two methods:

<Label for = "firstname"> First name:

<Input type = "text" name = "firstname" id = "firstname" tabindex = "1"/> </label>

Differences between the two

The screen reader nvda and ie9 test shows that the content prompted by the Screen Reader user is different:

• Explicit label: "ffirst name: blank edit box (or content )"

• Implicit label Syntax: "First name: Text first name: blank edit box (or content)"-the two methods are consistent, however, the last method cannot activate the form control when you click label in all browsers (I have changed it by mistake in the demo). This method is strongly not recommended.

As you can see, nvda repeats the label text content, making it easier for screen reader users to understand the prompts for explicit label writing.

View demo

Update: HTML5 accessibility chops: Form control labeling

Http://www.html5accessibility.com/tests/form-labels.html)

After the same test, the author tested more browsers and screen readers, checked the test demo page and result page, and obtained the same conclusion: using for and ID, and the form control is not placed in the label element is the most robust method.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.