Skip to main content
🚀 See how 20+ AI Agents can make your QA faster and smarter. Join 10k+ QAs at global leadership summit! Register Now
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

input-label-name-mismatch

Rule Severity : Serious

Description

You must ensure that form elements have their visible label text as a part of their accessible name.

Users who rely on screen readers or speech-input software access a form element by its accessible name. If the accessible name does not contain the visible label text, it causes confusion. This is especially important when you use attributes like aria-label or aria-labelledby to provide a different or more descriptive accessible name than the visible text. The visible text must still be present within the new accessible name.

The input-label-name-mismatch rule aligns with WCAG Success Criterion 2.5.3: Label in Name, which requires that the accessible name contains the text of the visible label.

Examples

In the following example, the visible label is Email. The accessible name, set by aria-label, is Enter your address. This violates the rule because the visible label “Email” is missing from the accessible name.

Incorrect Sample
Copy icon Copy

In the following corrected example, the visible label text, Email, is included at the start of the descriptive accessible name:

Correct Sample
Copy icon Copy

How to fix?

To fix violations of the input-label-name-mismatch rule, follow these steps:

  1. Identify the exact visible label text associated with the form element.

  2. Ensure the entire visible label text appears as a part of the accessible name. If you use aria-label or aria-labelledby to modify the accessible name, explicitly prepend the visible label text to your value.

Reference

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy Check Circle