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

[feat] control-has-associated-label can't be configured to support parent elements with label props #987

Open
fnune opened this issue May 23, 2024 · 1 comment

Comments

@fnune
Copy link

fnune commented May 23, 2024

From https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/control-has-associated-label.md#rule-options

labelAttributes is a list of attributes to check on the control component and its children for a label. Use this if you have a custom component that uses a string passed on a prop to render an HTML label, for example.

Unfortunately this only checks children elements of the component and won't allow for setups like this:

<Form.Item label="...">
  <Input />
</Form.Item>
@ljharb
Copy link
Member

ljharb commented May 23, 2024

At some complexity of abstractions there's not much static analysis can do for you. Is <Input /> a placeholder here, or is it an actual component you're using?

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

2 participants