label-not-persistent
Rule Severity : Serious
Description
Labels for form controls or interactive elements must remain visible at all times. This ensures that users, including those relying on assistive technologies, can always identify the purpose of the control or element.
Labels that disappear or become hidden when interacting with a control can confuse users, especially those with cognitive disabilities or those using screen readers.
The label-not-persistent
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, the label for the input field disappears when the user starts typing, violating the label-not-persistent
rule:
In the corrected example, the label remains visible at all times, ensuring users can always identify the purpose of the input field:
How to fix?
To fix violations of the label-not-persistent
rule, follow these steps:
- Ensure that labels for form controls or interactive elements are always visible.
- Avoid using placeholder text as a replacement for visible labels.
- Use ARIA attributes (e.g.,
aria-label
oraria-labelledby
) only when a visible label cannot be provided, and ensure the label is still accessible to assistive technologies. - Test your implementation with screen readers and other assistive tools to confirm labels remain accessible and visible.
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!