missing-group-label
Rule Severity : Serious
Description
Groups of fields must have a visible label to ensure that users, including those using assistive technologies, can understand the context and purpose of the grouped fields. This 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.
The missing-group-label
rule ensures that groups of fields, such as those wrapped in a <fieldset>
, are accompanied by a visible label (e.g., using a <legend>
element). This helps users comprehend the relationship between the fields and the overall structure of the form.
Examples
In the following example, a group of fields is created using the <fieldset>
element, but no visible label is provided. This violates the missing-group-label
rule because users cannot determine the purpose of the grouped fields.
In the following corrected example, a visible label is added using the <legend>
element, providing context for the grouped fields:
How to fix?
To fix violations of the missing-group-label
rule, follow these steps:
- Identify all groups of fields on your webpage that lack a visible label.
- Use the
<legend>
element within a<fieldset>
to provide a visible label for the group. - Ensure the label clearly describes the purpose or context of the grouped fields.
- Test the form with assistive technologies to confirm that the label is accessible and properly conveyed.
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!