From 36b78e9cea8207cf14b64c11271a3bbe6033464a Mon Sep 17 00:00:00 2001
From: Erin Song <121973038+erinysong@users.noreply.github.com>
Date: Fri, 22 Nov 2024 11:43:31 -0800
Subject: [PATCH] Refactor legends from two separate legends to one combined
legend
---
.../forms/utility/wizard_form_helper.py | 5 +++--
.../templates/django/forms/label.html | 21 +++++++++----------
.../domain_request_other_contacts.html | 11 +++-------
src/registrar/templatetags/field_helpers.py | 6 ++++++
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/registrar/forms/utility/wizard_form_helper.py b/src/registrar/forms/utility/wizard_form_helper.py
index 22c70b010..d48f7af64 100644
--- a/src/registrar/forms/utility/wizard_form_helper.py
+++ b/src/registrar/forms/utility/wizard_form_helper.py
@@ -241,7 +241,8 @@ class BaseYesNoForm(RegistrarForm):
# Option to append question to aria label for screenreader accessibility.
# Not added by default.
- aria_label = ""
+ title_label = ""
+ aria_label = title_label.join("")
def __init__(self, *args, **kwargs):
"""Extend the initialization of the form from RegistrarForm __init__"""
@@ -262,7 +263,7 @@ class BaseYesNoForm(RegistrarForm):
initial=self.get_initial_value(),
widget=forms.RadioSelect(
attrs={
- "aria-label": self.aria_label
+ # "aria-label": self.title_label
}
),
error_messages={
diff --git a/src/registrar/templates/django/forms/label.html b/src/registrar/templates/django/forms/label.html
index e4d7842fa..eb9604dec 100644
--- a/src/registrar/templates/django/forms/label.html
+++ b/src/registrar/templates/django/forms/label.html
@@ -1,25 +1,24 @@
-{% if not type == "radio" and not label_tag == "legend" %}
- <{{ label_tag }}
- class="{% if label_classes %} {{ label_classes }}{% endif %}{% if label_tag == 'legend' %} {{ legend_classes }}{% endif %}"
- {% if not field.use_fieldset %}for="{{ widget.attrs.id }}"{% endif %}
- >
-{% endif %}
-
+<{{ label_tag }}
+ class="{% if label_classes %} {{ label_classes }}{% endif %}{% if label_tag == 'legend' %} {{ legend_classes }}{% endif %}"
+ {% if not field.use_fieldset %}for="{{ widget.attrs.id }}"{% endif %}
+>
+ {% if legend_label %}
+
{{ legend_label }}
+ {% else %}
{% if span_for_text %}
{{ field.label }}
{% else %}
{{ field.label }}
{% endif %}
+ {% endif %}
{% if widget.attrs.required %}
- {% if field.label == "Is your organization an election office?" or field.label == "What .gov domain do you want?" or field.label == "I read and agree to the requirements for operating a .gov domain." or field.label == "Please explain why there are no other employees from your organization we can contact to help us assess your eligibility for a .gov domain." %}
+ {% if field.label == "Is your organization an election office?" or field.label == "What .gov domain do you want?" or field.label == "I read and agree to the requirements for operating a .gov domain." or field.label == "Please explain why there are no other employees from your organization we can contact to help us assess your eligibility for a .gov domain." or field.label == "Has other contacts" %}
{% else %}
*
{% endif %}
{% endif %}
-{% if not type == "radio" and not label_tag == "legend" %}
- {{ label_tag }}>
-{% endif %}
+{{ label_tag }}>
diff --git a/src/registrar/templates/domain_request_other_contacts.html b/src/registrar/templates/domain_request_other_contacts.html
index 72e4abd8b..93fafe872 100644
--- a/src/registrar/templates/domain_request_other_contacts.html
+++ b/src/registrar/templates/domain_request_other_contacts.html
@@ -17,17 +17,12 @@
{% endblock %}
{% block form_fields %}
-