Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

label-has-associated-control - misleading error message #1006

Closed
BillyLevin opened this issue Aug 23, 2024 · 1 comment
Closed

label-has-associated-control - misleading error message #1006

BillyLevin opened this issue Aug 23, 2024 · 1 comment

Comments

@BillyLevin
Copy link
Contributor

This rule checks two things:

  1. A label has an associated control component
  2. The label contains accessible text

However, the error message never accounts for the second case. So, if we had this code:

function Thing() {
  return (
    <div>
      <label htmlFor="js_id" />
      <input id="js_id" />
    </div>
  );
}

We get the error message: A form label must be associated with a control., which is not actually what the issue is.

I think it would be helpful to have a separate error message for this case, something like: A form label must have accessible text. to clear up any confusion between the two cases

@BillyLevin
Copy link
Contributor Author

BillyLevin commented Aug 23, 2024

Somehow created a duplicate of #1005

@BillyLevin BillyLevin closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant