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

Incorrect error for vuejs-accessibility/label-has-for? #133

Closed
AustinGil opened this issue Apr 25, 2021 · 7 comments
Closed

Incorrect error for vuejs-accessibility/label-has-for? #133

AustinGil opened this issue Apr 25, 2021 · 7 comments

Comments

@AustinGil
Copy link

Getting a weird issue with form labels. ESLint is complaining:

Form label must have an associated control.eslint(vuejs-accessibility/label-has-for)

But the code is correct:

<label for="email">Email:</label>
<input id="email" name="email" type="email" required />

image

Am I missing something?

@vhoyer
Copy link
Collaborator

vhoyer commented Apr 25, 2021

#119

check this solution, report back if you are still having trouble

@AustinGil
Copy link
Author

Thanks @vhoyer. Your comments in that thread helped me set it up correctly.

I also just saw the docs where it says "To fully cover 100% of assistive devices, you're encouraged to validate for both nesting and id."

I know sometimes nesting alone doesn't work, but I've never heard of ID not being enough. Can you share any more information around when using an ID alone fails or why?

@vhoyer
Copy link
Collaborator

vhoyer commented Apr 26, 2021

I personally can't share any use case where I've encountered such a problem. This other issue should provide some interesting information if you are interested :D #54

The author there mentions:

"There seems to be no accessibility advantage to using <label> as a wrapper if you've already given it a for attribute."

That said, I don't know any of this advantage neither did the author mentioned them... so... bummer, maybe you could provide more information to that discussion, or even just agree that we should change the default 🤷 (as it causes a lot of issues to appear here)

EDIT: added a blockquote because I think they were made for this kind of occasions haha.

@AustinGil
Copy link
Author

Yeah, I just posted my comments over there. I did quite a bit of research on the subject and did not come up with anything that suggested you need both to be fully accessible. I could be wrong, but my stance is that ID is required, but not wrapping label.

@aitelia
Copy link

aitelia commented Apr 28, 2022

This is still not working in "eslint-plugin-vuejs-accessibility": "1.1.1". Any updates on the solution to fix this false positive issue?
Screenshot 2022-04-28 at 11 42 47

@vhoyer
Copy link
Collaborator

vhoyer commented Apr 28, 2022

This is still not working in "eslint-plugin-vuejs-accessibility": "1.1.1". Any updates on the solution to fix this false positive issue?
Screenshot 2022-04-28 at 11 42 47

Have you checked the #119 yet, @aitelia?

@aitelia
Copy link

aitelia commented Apr 28, 2022

@vhoyer yes, I have found that workaround eventually.

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

3 participants