-
-
Notifications
You must be signed in to change notification settings - Fork 639
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
control-has-associated-label returns false positive, even wrapped AND with htmlFor #681
Comments
I assume this is because it’s inside a render prop instead of being an actual child. I don’t think it’s safe to assume that a render prop will be rendered, so I’m not sure what the solution would be. I agree that if/since that render prop ends up being rendered as a child of the label, it’s fine. Is there a reason you couldn’t put the label inside the render prop too? |
We tried that, and I just tried again, to make sure I didn't miss anything, but it still shows as wrong in VSCode and when running eslint. This does not fix the issue:
|
That's very strange - in the last example, I can't see any reason why it wouldn't pass. |
Also experiencing this issue. Can be reproduced as simple as: import React from "react"
export default () => {
return (
<label>
Foo
<input type="text" />
</label>
)
} |
Forgive me, a framework had turned this to straight warning which was causing a slew of warnings |
@herecydev that one also needs for/ID-linking to be valid with the airbnb config, for example. |
eslint version: 6.8.0
eslint-plugin-jsx-a11y: 6.2.3
The following code block, with a label wrapping an input, AND a htmlFor attribute on the label with the ID of the input, is still being flagged by ESLint, both at the command line and in VSCode integration.
<Field>
component to render the input (https://jaredpalmer.com/formik/docs/api/field)The rendered DOM looks accessesible,
and none of the 3 elements get flagged with the Axe Chrome plugin.
Is this a bug in the jsx-a11y plugin?
The text was updated successfully, but these errors were encountered: