question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

label-has-for fails for bound id/label

See original GitHub issue

When using a dynamic for / id attribute on label / input elements the rule label-has-for fails.

error: Form label must have associated control (vue-a11y/label-has-for)

<template>
  <label :for="_uid">
    <input :id="_uid">
  </label>
</template>

Expected behaviour: The rule passes.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
venikmancommented, Jul 2, 2019

I got it work. The problem that looks like that rule was taken from react rules. You can see it in documentation for rule. Name of rule for react. jsx-a11y/label-has-for". So what I had to do it to add options for it.

"vue-a11y/label-has-for": [ 2, {
            "components": [ "label" ],
            "required": {
                "every": [ "nesting", "id" ]
            },
            "allowChildren": false
        }]

I changed jsx to vue and Label to label I will probably can open a PR to fix it.

0reactions
ZebulanStanphillcommented, Aug 27, 2020

It’s worth noting that eslint-plugin-jsx-a11y’s label-has-for has recently been deprecated and replaced by label-has-associated-control. This plugin should probably follow suit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating Bootstrap 4 labels in forms
The label has “for” attribute that is used to bind an input type like textbox by its ID. As you click on the...
Read more >
Prometheus: Up & Running - The Swiss Bay
Prometheus does not include failed scrapes in its application logs, ... 7 For batch jobs such as database backups that are tied to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found