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

label-has-associated-control false positive with empty label #578

Open
Eschon opened this issue Mar 26, 2019 · 3 comments
Open

label-has-associated-control false positive with empty label #578

Eschon opened this issue Mar 26, 2019 · 3 comments

Comments

@Eschon
Copy link

Eschon commented Mar 26, 2019

I ran into this problem today. I have the rule configured like this:

"jsx-a11y/label-has-associated-control": [ 2, {
  "assert": "either"
}],

And it shows the error for the following example:

import React from 'react';

export default function Test() {
  return (
    <div>
      <label htmlFor="test" />
      <input type="checkbox" id="test" defaultChecked />
    </div>
  );
}

If I change it like this it works:

import React from 'react';

export default function Test() {
  return (
    <div>
      <label htmlFor="test">
		test
	  </label>
      <input type="checkbox" id="test" defaultChecked />
    </div>
  );
}

In my case I want no text inside my label because I set it through css with the ::before pseudo element

@ljharb
Copy link
Member

ljharb commented Mar 26, 2019

Duplicate of #566.

@ljharb ljharb closed this as completed Mar 26, 2019
@Eschon
Copy link
Author

Eschon commented Apr 1, 2019

@ljharb I'm not sure how this is a duplicate. #566 is about the control-has-associated-label while my issue is with the label-has-associated-control. Also for me the problem specifically happens with empty labels which isn't mentioned at all in #566

@ljharb
Copy link
Member

ljharb commented Apr 1, 2019

ah, gotcha, you’re right that it’s not a duplicate.

However, there’s no way for us to statically determine that you’ve set that css, and I’m not actually sure of the a11y impact there - I’ll reopen, but i very strongly suspect that literal text is better, and that you may want an override comment otherwise.

@ljharb ljharb reopened this Apr 1, 2019
anomiex added a commit to Automattic/jetpack that referenced this issue Nov 14, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.
anomiex added a commit to Automattic/jetpack that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.
matticbot pushed a commit to Automattic/social-logos that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-components that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-publicize-components that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/classic-theme-plugin that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-crm that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/automattic-for-agencies-client that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-storybook that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-inspect that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-forms that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-protect-plugin that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-starter-plugin that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-boost-production that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-mu-wpcom that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-backup-plugin that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-social-plugin that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-videopress-plugin that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-mu-wpcom-plugin that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/wpcom-site-helper that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-search-plugin that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
matticbot pushed a commit to Automattic/jetpack-production that referenced this issue Nov 18, 2024
* We no longer need to care about nanoid v3 thinking "browser === esm",
  because the GB package that had that dep no longer does.
* Various `jsx-a11y/label-has-associated-control` ignores referring to
  jsx-eslint/eslint-plugin-jsx-a11y#869 seem to be fixed now that #39736
  requires we use `htmlFor`. The one place still needing an ignore is
  jsx-eslint/eslint-plugin-jsx-a11y#578 instead.
* Remove reference to deleted renovate issue.
* Move reference to a Storybook bug to the code actually implementing
  the workaround.
* Update Storybook FAQ reference.
* Remove TODO references to a fixed Storybook bug (and fix a wrong prop
  in one story).
* Remove workaround for WordPress/WordPress-Coding-Standards#2390.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11896972496

Upstream-Ref: Automattic/jetpack@62e385b
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