jsx-eslint / eslint-plugin-jsx-a11y

Static AST checker for a11y rules on JSX elements.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

label-has-associated-control error

whtjs opened this issue · comments

commented
image

i have followed example code that link provide (label-has-associated-control)

but it still making lint error. i think there is some issue

The issue is likely that you also need a for/id relationship between the label and the input; nesting isn't sufficient.

commented

oh so you mean nesting case may can solve some problem but not in my case?

No, I mean that the rule can be configured three ways: nesting only, ID linking only, or both. To be truly accessible, "both" is always required.

commented

oh than i have to try change my .eslintrc

That's one path, but then you're not being fully accessible - some devices only work with nesting, some only with linking, so you must do both to match the spirit of this rule, and to be fully inclusive.

Closing, since it's answered.