8000 bug #24434 [Form] Use for=ID on radio/checkbox label. (Nyholm) · symfony/symfony@79c1f5e · GitHub
[go: up one dir, main page]

Skip to content

Commit 79c1f5e

Browse files
committed
bug #24434 [Form] Use for=ID on radio/checkbox label. (Nyholm)
This PR was merged into the 2.7 branch. Discussion ---------- [Form] Use for=ID on radio/checkbox label. | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | I recently let Europe's leading accessibility experts (Funkanu.se) review a site of mine, they gave me (among other) this feedback. > Putting the checkbox/radio input inside the label is great, but the label still needs the "for=ID". Screen readers like Jaws does not work properly without this attribute. Commits ------- 53d7857 Use for=ID on radio/checkbox label.
2 parents 42a41b3 + 53d7857 commit 79c1f5e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,14 @@
148148
{% endblock %}
149149

150150
{% block checkbox_label -%}
151+
{%- set label_attr = label_attr|merge({'for': id}) -%}
152+
151153
{{- block('checkbox_radio_label') -}}
152154
{%- endblock checkbox_label %}
153155

154156
{% block radio_label -%}
157+
{%- set label_attr = label_attr|merge({'for': id}) -%}
158+
155159
{{- block('checkbox_radio_label') -}}
156160
{%- endblock radio_label %}
157161

0 commit comments

Comments
 (0)
0