Fix checkbox / switch fields invalid state
In the custom form theme block checkbox_radio_label, the field validity is incorrectly determined using form.parent.vars.valid. This checks the validity of the entire parent form, not the individual field.
Fix #31
❌ Current behavior
{% if checked and form.parent.vars.valid == false %}
{% set valid = false %}
{% endif %}
Even if the current field has no validation error, it is marked as invalid if any other field in the parent form is invalid.
✅ Expected behavior
The validity check should be scoped to the current field only.
🛠️ Impact
This causes incorrect error styling on checkbox or radio labels, even when they are valid, as soon as any unrelated form field fails validation.
just as a follow up, I have overridden the checkbox_radio_label and switch_label blocks with your fix on one of my project and this seems to fix the issue well !
thanks a lot