mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Fix duplicate labels on form inputs
It’s invalid HTML to have multiple labels nested within each other. This
was happening by accident because WTForms tries to be clever – when you
put `{{ field.label }}` in a template it prints a `<label>` tag for you,
not just the text of the label. But we put our own `<label>` tags in the
HTML to have more control of them.
This commit stops WTForms being so clever.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{% macro file_upload(field, button_text="Choose file", alternate_link=None, alternate_link_text=None) %}
|
||||
<form method="post" enctype="multipart/form-data" class="{% if field.errors %}error{% endif %}" data-module="file-upload">
|
||||
<label class="file-upload-label" for="{{ field.name }}">
|
||||
<span class="visually-hidden">{{ field.label }}</span>
|
||||
<span class="visually-hidden">{{ field.label.text }}</span>
|
||||
{% if hint %}
|
||||
<span class="form-hint">
|
||||
{{ hint }}
|
||||
|
||||
Reference in New Issue
Block a user