Version: SonarQube v10.5 (89998)
Rule: S6853: Label elements should have a text label and an associated control
This code triggers the rule:
<label class="btn btn-white">
<input type="checkbox"
id="cb_${item.id}"
name="id"
value.bind="item.id"
checked.bind="selectedItems">
</label>
By reading the rule I think it is because there is no text content in the label
.
However the short rule description in SonarQube’s issue list is simply:
A form label must be associated with a control.
This works well when there is no control / for
attribute, but in the specific case I mentioned it seems quite unclear. By contrast, the full rule name clearly mentions the “text” part of the label.