From 64057f8d052f12ceaeafaa55c70b574be4d41fbd Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 19 Oct 2026 16:07:11 +0300 Subject: [PATCH] fix(templates): icon-only buttons, selects and delete pages have accessible names An accessibility scan (axe-core, WCAG 2 A/AA) of every page found 87 elements without a name. Icon-only buttons and links (the navbar's administration menu on every page, the add/create buttons, the flavor delete and back buttons) get a title, which is also their tooltip; the labels of the language, architecture, chipset and filter selects point at them; the memory bar is named. The shared delete confirmation page had an empty and heading, as no view passes "title": it says "Delete <object>". The power-off form's aria-label was misspelled. --- admin/templates/admin/group_list.html | 2 +- admin/templates/admin/user_list.html | 2 +- admin/tests/test_views.py | 2 ++ appsettings/templates/appsettings.html | 4 ++-- computes/templates/computes/instances.html | 2 +- instances/templates/allinstances_index_grouped.html | 2 +- instances/templates/create_flav_block.html | 2 +- instances/templates/create_inst_block.html | 2 +- instances/templates/create_instance_w1.html | 4 ++-- instances/templates/create_instance_w2.html | 6 +++--- instances/templates/instances/power_tab.html | 2 +- interfaces/templates/create_iface_block.html | 2 +- networks/templates/create_net_block.html | 2 +- nwfilters/templates/add_nwf_rule.html | 2 +- nwfilters/templates/create_nwfilter_block.html | 2 +- nwfilters/templates/nwfilter.html | 4 ++-- storages/templates/create_stg_block.html | 2 +- storages/templates/create_stg_vol_block.html | 2 +- templates/common/confirm_delete.html | 4 ++-- templates/navbar.html | 2 +- virtsecrets/templates/create_secret_block.html | 2 +- 21 files changed, 28 insertions(+), 26 deletions(-) diff --git a/admin/templates/admin/group_list.html b/admin/templates/admin/group_list.html index 44120272..6b7c14cd 100644 --- a/admin/templates/admin/group_list.html +++ b/admin/templates/admin/group_list.html @@ -6,7 +6,7 @@ {% block content %} <div class="row"> <div class="col-lg-12"> - <a href="{% url 'admin:group_create' %}" class="btn btn-success btn-header float-end"> + <a href="{% url 'admin:group_create' %}" class="btn btn-success btn-header float-end" title="{% trans "Create Group" %}"> {% bs_icon 'plus-circle-fill' %} </a> {% include 'search_block.html' %} diff --git a/admin/templates/admin/user_list.html b/admin/templates/admin/user_list.html index 85a32b78..4ddf2c42 100644 --- a/admin/templates/admin/user_list.html +++ b/admin/templates/admin/user_list.html @@ -9,7 +9,7 @@ {% block page_heading %}{{ title }}{% endblock page_heading %} {% block page_heading_extra %} -<a href="{% url 'admin:user_create' %}" class="btn btn-success btn-header float-end"> +<a href="{% url 'admin:user_create' %}" class="btn btn-success btn-header float-end" title="{% trans "Create User" %}"> {% bs_icon 'plus-circle-fill' %} </a> {% include 'search_block.html' %} diff --git a/admin/tests/test_views.py b/admin/tests/test_views.py index 5ed5e09c..aea83835 100644 --- a/admin/tests/test_views.py +++ b/admin/tests/test_views.py @@ -39,6 +39,8 @@ class AdminTestCase(TestCase): response = self.client.get(reverse("admin:group_delete", args=[group_id])) self.assertEqual(response.status_code, 200) + # the shared confirmation page names what it deletes + self.assertContains(response, "<title>Delete Updated Group Test", html=True) response = self.client.post(reverse("admin:group_delete", args=[group_id])) self.assertRedirects(response, reverse("admin:group_list")) diff --git a/appsettings/templates/appsettings.html b/appsettings/templates/appsettings.html index 28f67571..acce2fef 100644 --- a/appsettings/templates/appsettings.html +++ b/appsettings/templates/appsettings.html @@ -12,9 +12,9 @@
{% csrf_token %}
- +
- {% get_current_language as LANGUAGE_CODE %} {% get_available_languages as LANGUAGES %} {% get_language_info_list for LANGUAGES as languages %} diff --git a/computes/templates/computes/instances.html b/computes/templates/computes/instances.html index 8e3fc077..1b828b70 100644 --- a/computes/templates/computes/instances.html +++ b/computes/templates/computes/instances.html @@ -11,7 +11,7 @@ {% block page_heading_extra %} + class="btn btn-success btn-header float-end" title="{% trans "New Instance" %}"> {% bs_icon 'plus-circle-fill' %} {% if instances %} diff --git a/instances/templates/allinstances_index_grouped.html b/instances/templates/allinstances_index_grouped.html index c25c4358..38fd6d2d 100644 --- a/instances/templates/allinstances_index_grouped.html +++ b/instances/templates/allinstances_index_grouped.html @@ -42,7 +42,7 @@ {{ compute.ram_size|filesizeformat }}
-
{{ compute.ram_usage }}%
diff --git a/instances/templates/create_flav_block.html b/instances/templates/create_flav_block.html index 5535b76f..5aa2c6f5 100644 --- a/instances/templates/create_flav_block.html +++ b/instances/templates/create_flav_block.html @@ -2,7 +2,7 @@ {% load django_bootstrap5 %} {% load bootstrap_icons %} {% if request.user.is_superuser %} - diff --git a/instances/templates/create_inst_block.html b/instances/templates/create_inst_block.html index 3fcfa9ff..fcb51a83 100644 --- a/instances/templates/create_inst_block.html +++ b/instances/templates/create_inst_block.html @@ -1,6 +1,6 @@ {% load i18n %} {% load bootstrap_icons %} - + diff --git a/instances/templates/create_instance_w1.html b/instances/templates/create_instance_w1.html index 81ed91ac..37a49bec 100644 --- a/instances/templates/create_instance_w1.html +++ b/instances/templates/create_instance_w1.html @@ -47,7 +47,7 @@
{% csrf_token %}
- +
diff --git a/instances/templates/create_instance_w2.html b/instances/templates/create_instance_w2.html index 5bd40a6c..1c481742 100644 --- a/instances/templates/create_instance_w2.html +++ b/instances/templates/create_instance_w2.html @@ -41,7 +41,7 @@
- + {% bs_icon 'plus'%} {% csrf_token %} - diff --git a/instances/templates/instances/power_tab.html b/instances/templates/instances/power_tab.html index 5de19e63..28acaa89 100644 --- a/instances/templates/instances/power_tab.html +++ b/instances/templates/instances/power_tab.html @@ -63,7 +63,7 @@ {% if instance.status == 1 or instance.status == 2 %}

{% trans "This action sends an ACPI shutdown signal to the instance." %}

-
+ {% csrf_token %}
diff --git a/interfaces/templates/create_iface_block.html b/interfaces/templates/create_iface_block.html index 47550f67..3cac2efe 100644 --- a/interfaces/templates/create_iface_block.html +++ b/interfaces/templates/create_iface_block.html @@ -1,7 +1,7 @@ {% load i18n %} {% load bootstrap_icons %} {% if request.user.is_superuser %} - + diff --git a/networks/templates/create_net_block.html b/networks/templates/create_net_block.html index c38262e3..20634b2f 100644 --- a/networks/templates/create_net_block.html +++ b/networks/templates/create_net_block.html @@ -1,7 +1,7 @@ {% load i18n %} {% load bootstrap_icons %} {% if request.user.is_superuser %} - + diff --git a/nwfilters/templates/add_nwf_rule.html b/nwfilters/templates/add_nwf_rule.html index 64069094..3457949d 100644 --- a/nwfilters/templates/add_nwf_rule.html +++ b/nwfilters/templates/add_nwf_rule.html @@ -1,7 +1,7 @@ {% load i18n %} {% load bootstrap_icons %} {% if request.user.is_superuser %} - diff --git a/nwfilters/templates/create_nwfilter_block.html b/nwfilters/templates/create_nwfilter_block.html index df1207ba..0823afd0 100644 --- a/nwfilters/templates/create_nwfilter_block.html +++ b/nwfilters/templates/create_nwfilter_block.html @@ -1,7 +1,7 @@ {% load i18n %} {% load bootstrap_icons %} {% if request.user.is_superuser %} - diff --git a/nwfilters/templates/nwfilter.html b/nwfilters/templates/nwfilter.html index 081a3cbd..faf18b8e 100644 --- a/nwfilters/templates/nwfilter.html +++ b/nwfilters/templates/nwfilter.html @@ -69,14 +69,14 @@
{% else %} - + diff --git a/templates/common/confirm_delete.html b/templates/common/confirm_delete.html index ce917ae4..9e701dde 100644 --- a/templates/common/confirm_delete.html +++ b/templates/common/confirm_delete.html @@ -3,9 +3,9 @@ {% load bootstrap_icons %} {% load i18n %} -{% block title %}{{ title }}{% endblock %} +{% block title %}{% trans "Delete" %} {{ object }}{% endblock %} -{% block page_heading %}{{ title }}{% endblock page_heading %} +{% block page_heading %}{% trans "Delete" %} {{ object }}{% endblock page_heading %} {% block content %}
diff --git a/templates/navbar.html b/templates/navbar.html index a57e031e..5b0b6115 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -25,7 +25,7 @@ {% if request.user.is_superuser %}