In bootstrap, what is the role of form attribute role = & quot; form & quot ?, Bootstraprole

Source: Internet
Author: User

In bootstrap, what is the role of form attribute role = "form ?, Bootstraprole

In essence, the role in html enhances semantics. When the existing HTML tags cannot fully express semantics, they can be explained by role. This usually occurs on some custom components, which can enhance the accessibility, availability and interactivity of the components.
Role is used to describe the actual function of a non-standard tag. For example, if the div is used as the button, set the div's role = "button", and the auxiliary tool can recognize that this is actually a button.
For example,

<Div role = "checkbox" aria-checked = "checked"> </div>

The Helper tool will know that this div is actually a checkbox role and is selected.

Role is an attribute set for students with reading disabilities. The reading screen software can be used to resolve the issue. It has little to do with normal people. If you do not set it, the screen reading software cannot be parsed. If you do not set it, the reading software cannot be parsed.

Since it is a good programming habit, is it better to write all labels into role?
For example

<Div role = "div"> </div>

Normal text can be read, but sometimes there is no password prompt in the input password box in the form, prompting people to use Placeholder to write in the box. Normal people will know how to enter the password here, however, if you cannot read it, it will take effect.

The existence of the attribute role is used to tell an Accessibility application (for example, a screen reading program, a convenience program for the blind to access the network). This is a button. In html5 elements, labels themselves have semantics, so role does not need to be added. At least it is not recommended. However, many bootstrap cases have similar attributes and declarations, the purpose is to be compatible with older browsers (user agents). If your code uses html5 labels and does not support older browsers, you may not use the role label.

 

Related Article

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.