Skip to content

label-has-for doesn't report errors if there is no control wrapped inside #16

@thomaslombart

Description

@thomaslombart

I'm using the accessibility plugin, especially the rule label-has-for. My configuration looks like the following:

    'vuejs-accessibility/label-has-for': [
      'error',
      { required: { some: ['nesting', 'id'] } },
    ],

The problem is that the rule doesn't fire when I use it like that:

<label>
  <div></div>
</label>

It only fires when there is no elements in it:

<label></label>

II think the nesting validation rule is broken. I took a look at the implementation and I think this line is incomplete. It should check if there is a form control inside the children 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions