From c7ccce8f4141659a083e2db69d3b955209d5cca8 Mon Sep 17 00:00:00 2001 From: Moritz Strohm <strohm@data-quest.de> Date: Wed, 26 Jan 2022 15:29:45 +0000 Subject: [PATCH] fix for BIESt #553 --- app/views/course/members/accepted_list.php | 3 +-- app/views/course/members/autor_list.php | 3 +-- app/views/course/members/dozent_list.php | 3 +-- app/views/course/members/tutor_list.php | 3 +-- app/views/course/members/user_list.php | 3 +-- lib/classes/Avatar.class.php | 10 +++++----- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/app/views/course/members/accepted_list.php b/app/views/course/members/accepted_list.php index c25c7c1905b..e789a10c668 100644 --- a/app/views/course/members/accepted_list.php +++ b/app/views/course/members/accepted_list.php @@ -87,8 +87,7 @@ <?= Avatar::getAvatar($accept['user_id'], $accept['username'])->getImageTag( Avatar::SMALL, [ - 'style' => 'margin-right: 5px', - 'title' => $fullname, + 'style' => 'margin-right: 5px' ] ) ?> <?= htmlReady($fullname) ?> diff --git a/app/views/course/members/autor_list.php b/app/views/course/members/autor_list.php index 6d8e8da493c..ed031a43cef 100644 --- a/app/views/course/members/autor_list.php +++ b/app/views/course/members/autor_list.php @@ -98,8 +98,7 @@ <?= Avatar::getAvatar($autor['user_id'], $autor['username'])->getImageTag( Avatar::SMALL, [ - 'style' => 'margin-right: 5px', - 'title' => $fullname + 'style' => 'margin-right: 5px' ] ) ?> <?= htmlReady($fullname) ?> diff --git a/app/views/course/members/dozent_list.php b/app/views/course/members/dozent_list.php index 2206fb0488a..e955b569c12 100644 --- a/app/views/course/members/dozent_list.php +++ b/app/views/course/members/dozent_list.php @@ -53,8 +53,7 @@ <td> <a href="<?= $controller->url_for(sprintf('profile?username=%s',$dozent['username'])) ?>" <? if ($dozent['mkdate'] >= $last_visitdate) echo 'class="new-member"'; ?>> <?= Avatar::getAvatar($dozent['user_id'], $dozent['username'])->getImageTag(Avatar::SMALL, [ - 'style' => 'margin-right: 5px', - 'title' => $fullname, + 'style' => 'margin-right: 5px' ]) ?> <?= htmlReady($fullname) ?> </a> diff --git a/app/views/course/members/tutor_list.php b/app/views/course/members/tutor_list.php index b14674a7118..e07b4302a70 100644 --- a/app/views/course/members/tutor_list.php +++ b/app/views/course/members/tutor_list.php @@ -91,8 +91,7 @@ <td> <a href="<?= $controller->url_for('profile?username=' . $tutor['username']) ?>" <? if ($tutor['mkdate'] >= $last_visitdate) echo 'class="new-member"'; ?>> <?= Avatar::getAvatar($tutor['user_id'], $tutor['username'])->getImageTag(Avatar::SMALL, [ - 'style' => 'margin-right: 5px', - 'title' => $fullname, + 'style' => 'margin-right: 5px' ]) ?> <?= htmlReady($fullname) ?> </a> diff --git a/app/views/course/members/user_list.php b/app/views/course/members/user_list.php index c9bb48deddb..6ebd3b01f03 100644 --- a/app/views/course/members/user_list.php +++ b/app/views/course/members/user_list.php @@ -91,8 +91,7 @@ <td> <a href="<?= $controller->url_for('profile?username=' . $leser['username']) ?>" <? if ($leser['mkdate'] >= $last_visitdate) echo 'class="new-member"'; ?>> <?= Avatar::getAvatar($leser['user_id'],$leser['username'])->getImageTag(Avatar::SMALL, [ - 'style' => 'margin-right: 5px', - 'title' => $fullname, + 'style' => 'margin-right: 5px' ]); ?> <?= htmlReady($fullname) ?> </a> diff --git a/lib/classes/Avatar.class.php b/lib/classes/Avatar.class.php index b6b4e06deb4..b355a8ac093 100644 --- a/lib/classes/Avatar.class.php +++ b/lib/classes/Avatar.class.php @@ -244,9 +244,7 @@ class Avatar { $opt['class'] = $this->getCssClass($size); } - if (!isset($opt['title'])) { - $opt['title'] = $this->getDefaultTitle(); - } elseif (is_string($opt['title']) && $opt['title'] !== html_entity_decode($opt['title'])) { + if (is_string($opt['title']) && $opt['title'] !== html_entity_decode($opt['title'])) { // Decode already htmlready encoded titles (which were used until // all attributes were encoded inside this method) $opt['title'] = html_entity_decode($opt['title']); @@ -263,8 +261,10 @@ class Avatar { } } - if (!isset($opt['alt'])) { - $opt['alt'] = $opt['title']; + if (!isset($opt['alt']) && !isset($opt['title'])) { + //Add an empty alt attribute to prevent screen readers from + //reading the URL of the icon: + $opt['alt'] = ''; } return '<img ' . arrayToHtmlAttributes($opt) . '>'; -- GitLab