From bb4e2fe2dfe69fc3143f38c6e34dbe6f2f2f01e0 Mon Sep 17 00:00:00 2001 From: Martey Dodoo <martey@mobolic.com> Date: Mon, 5 Aug 2019 13:12:08 -0400 Subject: [PATCH] Add labels to snippet bulk edit checkboxes for screen reader users. Fix #5328 (#5463) --- CHANGELOG.txt | 1 + docs/releases/2.7.rst | 1 + .../templates/wagtailsnippets/snippets/list.html | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d83354cf1d..271383d594 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -12,6 +12,7 @@ Changelog * Fix: Changed StreamField group labels color so labels are visible (Catherine Farman) * Fix: Prevented images with a very wide aspect ratio from being displayed distorted in the rich text editor (Iman Syed) * Fix: Prevent exception when deleting a model with a protected One-to-one relationship (Neal Todd) + * Fix: Added labels to snippet bulk edit checkboxes for screen reader users (Martey Dodoo) 2.6.1 (05.08.2019) diff --git a/docs/releases/2.7.rst b/docs/releases/2.7.rst index 66d93a0f48..593e7ad258 100644 --- a/docs/releases/2.7.rst +++ b/docs/releases/2.7.rst @@ -30,6 +30,7 @@ Bug fixes * Changed StreamField group label color so labels are visible (Catherine Farman) * Prevented images with a very wide aspect ratio from being displayed distorted in the rich text editor (Iman Syed) * Prevent exception when deleting a model with a protected One-to-one relationship (Neal Todd) + * Added labels to snippet bulk edit checkboxes for screen reader users (Martey Dodoo) Upgrade considerations diff --git a/wagtail/snippets/templates/wagtailsnippets/snippets/list.html b/wagtail/snippets/templates/wagtailsnippets/snippets/list.html index 9e6ba2df30..927d3504c6 100644 --- a/wagtail/snippets/templates/wagtailsnippets/snippets/list.html +++ b/wagtail/snippets/templates/wagtailsnippets/snippets/list.html @@ -6,7 +6,12 @@ <col width="16%" /> <thead> <tr class="table-headers"> - {% if can_delete_snippets %}<th><input type="checkbox" class="toggle-select-all"/></th>{% endif %} + {% if can_delete_snippets %} + <th> + <input type="checkbox" class="toggle-select-all" id="toggle-select-all-snippets" /> + <label for="toggle-select-all-snippets" class="visuallyhidden">{% blocktrans with snippet_type_name_plural=model_opts.verbose_name_plural %}Select all {{ snippet_type_name_plural }}{% endblocktrans %}</label> + </th> + {% endif %} <th>{% trans "Title" %}</th> </tr> </thead> @@ -14,7 +19,10 @@ {% for snippet in items %} <tr id="snippet-row-{{ snippet.pk }}"> {% if can_delete_snippets %} - <td class="select"><input type="checkbox" name="select_snippet" value="{{ snippet.pk }}" class="toggle-select-row"/></td> + <td class="select"> + <input type="checkbox" name="select_snippet" id="select-snippet-{{ snippet.pk }}" value="{{ snippet.pk }}" class="toggle-select-row"/> + <label for="select-snippet-{{ snippet.pk }}" class="visuallyhidden">{% blocktrans %}Select {{ snippet }}{% endblocktrans %}</label> + </td> {% endif %} <td class="title"> {% if choosing %}