From d569a253cdf6842a37e45c5167630faad65242b6 Mon Sep 17 00:00:00 2001 From: Eevis Panula Date: Thu, 3 Dec 2020 15:11:20 +0200 Subject: [PATCH] Bugfix: Remove focus from avatars in notifications for better keyboard navigation (#11650) * Add tabindex=-1 to hide links from keyboard users * Add aria-hidden to hide the links from accessibility tree * When multiple followers, remove the first one from tab order as they are in the following text --- app/views/notifications/_aggregated_reactions.html.erb | 6 +++--- app/views/notifications/_follow.html.erb | 4 ++-- app/views/notifications/shared/_profile_pic.html.erb | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/notifications/_aggregated_reactions.html.erb b/app/views/notifications/_aggregated_reactions.html.erb index 419930d9a..2352748cc 100644 --- a/app/views/notifications/_aggregated_reactions.html.erb +++ b/app/views/notifications/_aggregated_reactions.html.erb @@ -4,14 +4,14 @@
<% if actors.size == 1 %> - " class="crayons-avatar crayons-avatar--l m:crayons-avatar--xl"> + " class="crayons-avatar crayons-avatar--l m:crayons-avatar--xl" aria-hidden="true" tabindex="-1"> " class="crayons-avatar__image" alt="link to <%= actors.first["username"] %>'s profile" width="48" height="48"> <% else %> - " class="crayons-avatar crayons-avatar--l mr-4"> + " class="crayons-avatar crayons-avatar--l mr-4" aria-hidden="true" tabindex="-1"> " class="crayons-avatar__image" alt="link to <%= actors.first["username"] %>'s profile" width="48" height="48"> - " class="crayons-avatar crayons-avatar--l absolute -right-1 -bottom-3 border-solid border-2 border-base-inverted"> + " class="crayons-avatar crayons-avatar--l absolute -right-1 -bottom-3 border-solid border-2 border-base-inverted" aria-hidden="true" tabindex="-1"> " class="crayons-avatar__image" alt="link to <%= actors.last["username"] %>'s profile" width="48" height="48"> <% end %> diff --git a/app/views/notifications/_follow.html.erb b/app/views/notifications/_follow.html.erb index 145073d5b..ae39174eb 100644 --- a/app/views/notifications/_follow.html.erb +++ b/app/views/notifications/_follow.html.erb @@ -2,7 +2,7 @@ <% if notification.json_data["aggregated_siblings"].length == 1 %> <% first_notification = notification.json_data["aggregated_siblings"].first %> <% cache "activity-profile-pic-#{first_notification['id']}-#{first_notification['profile_image_90']}" do %> - " class="crayons-avatar crayons-avatar--l <% if notification.json_data["aggregated_siblings"].length == 1 %>m:crayons-avatar--xl<% end %> shrink-0"> + " class="crayons-avatar crayons-avatar--l <% if notification.json_data["aggregated_siblings"].length == 1 %>m:crayons-avatar--xl<% end %> shrink-0" tabindex="-1" aria-hidden="true"> " class="crayons-avatar__image" alt="link to <%= first_notification["username"] %>'s profile" width="48" height="48"> <% end %> @@ -18,7 +18,7 @@ <% json_data_array = notification["json_data"]["aggregated_siblings"] %>