jsx-a11y/label-has-for never correct
I have recently upgraded our eslint and airbnb config amonst other things. I keep getting the lint error
error Form label must have associated control jsx-a11y/label-has-for
My code looks like this, but I also get the error when using just a string (instead of inputID).
<input
type="text"
id={inputID}
className="form-control u__hidden-sm-down"
value={inputValue}
onChange={this.handleInputChange}
onKeyUp={this.handleKeyRelease}
/>
<label
htmlFor={inputID}
className={formStyles.someRandomClass}
>
Search...
</label>
Am I doing something stylistically incorrectly here? I have a few examples of this happening in our application.
Order doesn't seem to matter.
If you're receiving this error during linting versus being logged to the console during runtime then that is an issue with the eslint-plugin-jsx-a11y plugin and you can file it here: https://github.com/evcohen/eslint-plugin-jsx-a11y
Our libraries are similar and complimentary but are distinctly separate.