multiple-labeled-controls
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/html-validate-standard
What it does
Section titled “What it does”Reports a <label> with no for that holds more than one control.
Why it matters
Section titled “Why it matters”A label names only the first control it holds, so the second control has no name and a click on the label text goes to the wrong one.
To fix, give each control its own label, with for and id.
Example
Section titled “Example”...<label for="c">C</label><input type="text" id="c"><input type="text" aria-label="d"><input type="hidden" name="e"><label>a <input id="x"> <input id="y"></label>...Configuration
Section titled “Configuration”angular: lint: rules: multiple-labeled-controls: warn # off (default), warn, errorhtml: lint: rules: multiple-labeled-controls: warn # off (default), warn, errorsvelte: lint: rules: multiple-labeled-controls: warn # off (default), warn, errorvue: lint: rules: multiple-labeled-controls: warn # off (default), warn, errorEnabled by the presets: html/html-validate-standard.
Suppress one line with sudsy-disable-next-line multiple-labeled-controls in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| html-validate | multiple-labeled-controls |
full |