summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorDavid Smith <smithdc@gmail.com>2021-06-11 07:39:12 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-08-27 06:14:01 +0200
commit5942ab5eb165ee2e759174e297148a40dd855920 (patch)
tree6018ad2e699cc2bac292c377bbbd86ea9fc99a89 /django/forms
parenta5cb1ef6eb842c38627ff6685b977fd42a342b67 (diff)
Refs #32338 -- Made RadioSelect/CheckboxSelectMultiple render in <div> tags.
This improves accessibility for screen reader users.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/jinja2/django/forms/widgets/multiple_input.html10
-rw-r--r--django/forms/templates/django/forms/widgets/multiple_input.html10
2 files changed, 10 insertions, 10 deletions
diff --git a/django/forms/jinja2/django/forms/widgets/multiple_input.html b/django/forms/jinja2/django/forms/widgets/multiple_input.html
index 21cd9b665d..aee0bd6852 100644
--- a/django/forms/jinja2/django/forms/widgets/multiple_input.html
+++ b/django/forms/jinja2/django/forms/widgets/multiple_input.html
@@ -1,5 +1,5 @@
-{% set id = widget.attrs.id %}<ul{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
- <li>{{ group }}<ul{% if id %} id="{{ id }}_{{ index }}"{% endif %}>{% endif %}{% for widget in options %}
- <li>{% include widget.template_name %}</li>{% endfor %}{% if group %}
- </ul></li>{% endif %}{% endfor %}
-</ul>
+{% set id = widget.attrs.id %}<div{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
+ <div><label>{{ group }}</label>{% endif %}{% for widget in options %}<div>
+ {% include widget.template_name %}</div>{% endfor %}{% if group %}
+ </div>{% endif %}{% endfor %}
+</div>
diff --git a/django/forms/templates/django/forms/widgets/multiple_input.html b/django/forms/templates/django/forms/widgets/multiple_input.html
index 0ba9942874..2a0fec6ecc 100644
--- a/django/forms/templates/django/forms/widgets/multiple_input.html
+++ b/django/forms/templates/django/forms/widgets/multiple_input.html
@@ -1,5 +1,5 @@
-{% with id=widget.attrs.id %}<ul{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
- <li>{{ group }}<ul{% if id %} id="{{ id }}_{{ index }}"{% endif %}>{% endif %}{% for option in options %}
- <li>{% include option.template_name with widget=option %}</li>{% endfor %}{% if group %}
- </ul></li>{% endif %}{% endfor %}
-</ul>{% endwith %}
+{% with id=widget.attrs.id %}<div{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
+ <div><label>{{ group }}</label>{% endif %}{% for option in options %}<div>
+ {% include option.template_name with widget=option %}</div>{% endfor %}{% if group %}
+ </div>{% endif %}{% endfor %}
+</div>{% endwith %}