From 6266b5c12a3cabc165e7b22f55a2b514ae978f4c Mon Sep 17 00:00:00 2001 From: Ryan Boog Date: Thu, 16 Sep 2021 15:02:43 -0500 Subject: [PATCH] Add conditional for label that ends up blank for checkboxes Without this conditional, checkboxes render a blank label `
` Having the blank label screws with accessibility. Sure, you can manually set each checkbox to `display_label: false` but that in itself is confusing since removes the broken label and keeps the checkbox label. Since the default checkbox no matter what creates a blank div and label, the best way around this is to just add this conditional --- templates/forms/layouts/field/default-field.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/forms/layouts/field/default-field.html.twig b/templates/forms/layouts/field/default-field.html.twig index 343c0c09..42735f3f 100644 --- a/templates/forms/layouts/field/default-field.html.twig +++ b/templates/forms/layouts/field/default-field.html.twig @@ -1,7 +1,7 @@ {% block field %}
{% block contents %} - {% if show_label %} + {% if show_label and field.type != 'checkbox' %}
{{- form_field_toggleable -}}