From 80b24698800fbd70265d78ef33175c519bca284e Mon Sep 17 00:00:00 2001
From: Erin Song <121973038+erinysong@users.noreply.github.com>
Date: Mon, 28 Oct 2024 16:11:13 -0700
Subject: [PATCH 01/11] Add screenreader only text to ds delete button
---
src/registrar/templates/domain_dsdata.html | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/registrar/templates/domain_dsdata.html b/src/registrar/templates/domain_dsdata.html
index 6e18bce13..ba742ab09 100644
--- a/src/registrar/templates/domain_dsdata.html
+++ b/src/registrar/templates/domain_dsdata.html
@@ -63,11 +63,12 @@
-
+
From 1bea78f872ff8fe53cdaa06919c1955c288d49d7 Mon Sep 17 00:00:00 2001
From: Erin Song <121973038+erinysong@users.noreply.github.com>
Date: Tue, 29 Oct 2024 17:16:19 -0700
Subject: [PATCH 02/11] Add aria label option for inputs
---
.../templates/django/forms/widgets/input.html | 1 +
src/registrar/templates/domain_nameservers.html | 3 ++-
.../templates/includes/input_with_errors.html | 2 +-
src/registrar/templatetags/field_helpers.py | 10 +++++++++-
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/registrar/templates/django/forms/widgets/input.html b/src/registrar/templates/django/forms/widgets/input.html
index f47fc6415..e7b43655d 100644
--- a/src/registrar/templates/django/forms/widgets/input.html
+++ b/src/registrar/templates/django/forms/widgets/input.html
@@ -4,6 +4,7 @@
{# hint: spacing in the class string matters #}
class="{{ uswds_input_class }}{% if classes %} {{ classes }}{% endif %}"
{% if widget.value != None %}value="{{ widget.value|stringformat:'s' }}"{% endif %}
+ {% if aria_label %}aria-label="{{ aria_label }} {{ label }}"{% endif %}
{% if sublabel_text %}aria-describedby="{{ widget.attrs.id }}__sublabel"{% endif %}
{% include "django/forms/widgets/attrs.html" %}
/>
diff --git a/src/registrar/templates/domain_nameservers.html b/src/registrar/templates/domain_nameservers.html
index fd6256f39..cc1fc0164 100644
--- a/src/registrar/templates/domain_nameservers.html
+++ b/src/registrar/templates/domain_nameservers.html
@@ -47,7 +47,7 @@
{% endwith %}
- {% with sublabel_text="Example: 86.124.49.54 or 2001:db8::1234:5678" add_group_class="usa-form-group--unstyled-error" %}
+ {% with label_text=form.ip.label sublabel_text="Example: 86.124.49.54 or 2001:db8::1234:5678" add_group_class="usa-form-group--unstyled-error" add_aria_label="Name server "|concat:forloop.counter|concat:" "|concat:form.ip.label %}
{% input_with_errors form.ip %}
{% endwith %}
@@ -56,6 +56,7 @@
Delete
+ Name server {{forloop.counter}}
diff --git a/src/registrar/templates/includes/input_with_errors.html b/src/registrar/templates/includes/input_with_errors.html
index d1e53968e..a7df4c052 100644
--- a/src/registrar/templates/includes/input_with_errors.html
+++ b/src/registrar/templates/includes/input_with_errors.html
@@ -66,7 +66,7 @@ error messages, if necessary.
{% if toggleable_input %}
{% include "includes/toggleable_input.html" %}
{% endif %}
-
+
{# this is the input field, itself #}
{% include widget.template_name %}
diff --git a/src/registrar/templatetags/field_helpers.py b/src/registrar/templatetags/field_helpers.py
index 68a803711..8a80a75b9 100644
--- a/src/registrar/templatetags/field_helpers.py
+++ b/src/registrar/templatetags/field_helpers.py
@@ -24,6 +24,7 @@ def input_with_errors(context, field=None): # noqa: C901
add_label_class: append to input element's label's `class` attribute
add_legend_class: append to input element's legend's `class` attribute
add_group_class: append to input element's surrounding tag's `class` attribute
+ add_aria_label: append to input element's `aria_label` attribute
attr_* - adds or replaces any single html attribute for the input
add_error_attr_* - like `attr_*` but only if field.errors is not empty
toggleable_input: shows a simple edit button, and adds display-none to the input field.
@@ -55,6 +56,7 @@ def input_with_errors(context, field=None): # noqa: C901
label_classes = []
legend_classes = []
group_classes = []
+ aria_labels = []
# this will be converted to an attribute string
described_by = []
@@ -98,6 +100,9 @@ def input_with_errors(context, field=None): # noqa: C901
if "display-none" not in classes:
classes.append("display-none")
+ elif key == "add_aria_label":
+ aria_labels.append(value)
+
attrs["id"] = field.auto_id
# do some work for various edge cases
@@ -151,7 +156,10 @@ def input_with_errors(context, field=None): # noqa: C901
# ensure we don't overwrite existing attribute value
if "aria-describedby" in attrs:
described_by.append(attrs["aria-describedby"])
- attrs["aria-describedby"] = " ".join(described_by)
+ attrs["aria_describedby"] = " ".join(described_by)
+
+ if aria_labels:
+ context["aria_label"] = " ".join(aria_labels)
# ask Django to give us the widget dict
# see Widget.get_context() on
From e72d1caaaec5cade5aaf6826db8047a4f94207a2 Mon Sep 17 00:00:00 2001
From: Erin Song <121973038+erinysong@users.noreply.github.com>
Date: Tue, 29 Oct 2024 17:19:02 -0700
Subject: [PATCH 03/11] Revert input_with_errors
---
src/registrar/templates/includes/input_with_errors.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/registrar/templates/includes/input_with_errors.html b/src/registrar/templates/includes/input_with_errors.html
index a7df4c052..d1e53968e 100644
--- a/src/registrar/templates/includes/input_with_errors.html
+++ b/src/registrar/templates/includes/input_with_errors.html
@@ -66,7 +66,7 @@ error messages, if necessary.
{% if toggleable_input %}
{% include "includes/toggleable_input.html" %}
{% endif %}
-
+
{# this is the input field, itself #}
{% include widget.template_name %}
From 57bb85ea86249a40f6cb65987b833285df28ba20 Mon Sep 17 00:00:00 2001
From: CocoByte
Date: Thu, 31 Oct 2024 09:30:34 -0600
Subject: [PATCH 04/11] updated screenreader for domains & domain-requests
search buttons
---
src/registrar/templates/includes/domain_requests_table.html | 4 ++--
src/registrar/templates/includes/domains_table.html | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/registrar/templates/includes/domain_requests_table.html b/src/registrar/templates/includes/domain_requests_table.html
index 5b7604222..5142131af 100644
--- a/src/registrar/templates/includes/domain_requests_table.html
+++ b/src/registrar/templates/includes/domain_requests_table.html
@@ -23,7 +23,7 @@
Reset
-