Eslint-plugin-jsx-a11y: control-has-associated-label false positive on link elements

Created on 11 Feb 2019  路  2Comments  路  Source: jsx-eslint/eslint-plugin-jsx-a11y

Greetings!

The website I am working on uses Next.js as a framework, and as such all html, including the page header, is defined in JSX. I've found that the rule control-has-associated-label is incorrectly flagging link elements in our header as interactive, and expecting labels.

For example:

<html lang="en">
  <NextHead>
    ...
    // ERROR: A control must be associated with a text label.
    <link rel="apple-touch-icon-precomposed" sizes="120x120" href="/static/favicon/apple-touch-icon-120x120.png" /> 
    ...
  </NextHead>
  ...
</html>

I can get around this by adding "ignoreElements": ["link"], to my eslint config for now, but I don't think this should be default behavior.

Thanks for the great plugin btw 鉁岋笍

Most helpful comment

@ljharb yes, me too. It's probably a bug in axobject-query.

@UncleClapton thank you for the report!

All 2 comments

I'm also surprised to see link considered a form control.

@ljharb yes, me too. It's probably a bug in axobject-query.

@UncleClapton thank you for the report!

Was this page helpful?
0 / 5 - 0 ratings