From 4055adf0a2e676be1a0428a32fe0dbbf7de8ec07 Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Mon, 4 Dec 2023 13:57:27 +0000 Subject: [PATCH] Provide unique aria labels for attachment edit and removal links This allows each link to be distinguished by individuals using screen readers to navigate quickly through all of the links on the page, which is a minimal accessibility standard according to WCAG 2.1 guidelines. --- app/views/admin/attachments/_attachments.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/attachments/_attachments.html.erb b/app/views/admin/attachments/_attachments.html.erb index d71b4385d5b..b6f301c3138 100644 --- a/app/views/admin/attachments/_attachments.html.erb +++ b/app/views/admin/attachments/_attachments.html.erb @@ -31,8 +31,8 @@ <% end %>
- <%= link_to("Edit attachment", [:edit, :admin, typecast_for_attachable_routing(attachable), attachment.becomes(Attachment)], class: "govuk-link govuk-link--no-visited-state") %> - <%= link_to("Delete attachment", [:confirm_destroy, :admin, typecast_for_attachable_routing(attachable), attachment.becomes(Attachment)], class: "govuk-link govuk-link--no-visited-state gem-link--destructive") %> + <%= link_to("Edit attachment", [:edit, :admin, typecast_for_attachable_routing(attachable), attachment.becomes(Attachment)], class: "govuk-link govuk-link--no-visited-state", "aria-label": "Edit attachment: #{attachment.title}") %> + <%= link_to("Delete attachment", [:confirm_destroy, :admin, typecast_for_attachable_routing(attachable), attachment.becomes(Attachment)], class: "govuk-link govuk-link--no-visited-state gem-link--destructive", "aria-label": "Delete attachment: #{attachment.title}") %>
<% if attachment != attachable.attachments.includes(:attachment_data).last %>