Home >Web Front-end >JS Tutorial >Accessibility (a) Rules - 5
Four main types of alternative media types: captions, transcripts, audio descriptions, and sign language interpretation should be included with audio and media files. These alternatives should be based on:
<div role="form"> <h4> Recommended — Standard HTML </h4> <pre class="brush:php;toolbar:false"><form>
Should add HTML autocomplete attributes to the fields.
Form fields should not produce contextual changes when they receive focus or user input unless the user has been warned about the behaviour before using the component (e.g. a form should not be automatically submitted when a field receives focus or once a user adds content to the field.)
Field descriptions are not required for accessibility if the labels or form instructions are descriptive enough.
Add field descriptions when more information is necessary to prevent user errors. For example, include input requirements like password length or specific date formats (e.g., MM-DD-YYYY).
Use the aria-describedby attribute to link field descriptions to form elements. This ensures screen readers read both the label and the description, improving clarity for users.
When a form error occurs, make the error immediately known. Clearly identify the field where the error happened and provide a concise, descriptive text explaining the error to the user.
There are different methods for displaying error messages, such as:
Be sure to pay attention to the keyboard focus and ARIA live region options when announcing errors.
Whenever possible, offer the user a detailed suggestion on how to fix the error. There are two attributes available to notify users of errors.
Target Size (Minimum)
Consistent Help
Accessible Authentication
Redundant Entry
The above is the detailed content of Accessibility (a) Rules - 5. For more information, please follow other related articles on the PHP Chinese website!