field-not-required
Rule Severity : Serious
Description
An optional field must not be indicated as required. This ensures that users are not misled into thinking they must provide information when it is not necessary. Properly indicating optional fields helps users understand which inputs are mandatory and which are not, improving the overall user experience and accessibility.
The field-not-required
rule aligns with WCAG Success Criterion 3.3.2 (Labels or Instructions), which requires that labels or instructions are provided when content requires user input.
Examples
In the following example, an optional field is incorrectly marked as required using the required attribute. This violates the field-not-required
rule because it misleads users into thinking they must provide information when it is not necessary.
In the following corrected example, the required attribute is removed, and the optional nature of the field is clearly indicated in the label:
How to fix?
To fix violations of the field-not-required
rule, follow these steps:
- Identify all optional fields on your webpage.
- Ensure that optional fields are not marked with the
required
oraria-required="true"
attributes. - If possible, clearly indicate in the label or instructions that the field is optional.
Reference
WCAG Success Criterion 3.3.2: Labels or Instructions
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!