Skip to content

a11y-label-has-associated-control error for control inside of component #6469

Closed
@nikmolnar

Description

@nikmolnar

Describe the bug

The a11y-label-has-associated-control linting error is raised whenever a nested control is contained in a child component. For example, if you have a custom component, TextInput, which renders an <input />, then this produces the "no associated control" error.

<label>
    A label
    <TextInput />
</label>

This issue is similar to #5528, where this error is generated if the input is inside a conditional statement.

Reproduction

This REPL demonstrates the issue: https://svelte.dev/repl/8396b0b08a2d460da2d7e781cc0ee4b7?version=3.38.3

Logs

No response

System Info

System:
    OS: macOS 11.1
    CPU: (6) x64 Intel(R) Core(TM) i5-8600 CPU @ 3.10GHz
    Memory: 122.49 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 10.22.1 - ~/.nvm/versions/node/v10.22.1/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.6 - ~/.nvm/versions/node/v10.22.1/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Firefox: 89.0
    Safari: 14.0.2
  npmPackages:
    svelte: ==3.36.0 => 3.36.0 
    webpack: ^5.37.1 => 5.37.1

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions