mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-70173 output: use an empty alt to hide user pic from screen readers
There is no need to use WAI-ARIA to hide images from screen readers. See https://www.w3.org/WAI/tutorials/images/decorative/
This commit is contained in:
parent
4e398ff3f7
commit
b0b3a53521
@ -126,7 +126,8 @@ class block_online_users extends block_base {
|
||||
} else { // Not a guest user.
|
||||
$this->content->text .= '<div class="user">';
|
||||
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->page->course->id.'" title="'.$timeago.'">';
|
||||
$this->content->text .= $OUTPUT->user_picture($user, array('size'=>16, 'alttext'=>false, 'link'=>false)) .$user->fullname.'</a></div>';
|
||||
$avataroptions = ['size' => 16, 'visibletoscreenreaders' => false, 'link' => false];
|
||||
$this->content->text .= $OUTPUT->user_picture($user, $avataroptions) . $user->fullname . '</a></div>';
|
||||
|
||||
if ($USER->id == $user->id) {
|
||||
if ($CFG->block_online_users_onlinestatushiding) {
|
||||
|
@ -2523,8 +2523,6 @@ class core_renderer extends renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
protected function render_user_picture(user_picture $userpicture) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$user = $userpicture->user;
|
||||
$canviewfullnames = has_capability('moodle/site:viewfullnames', $this->page->context);
|
||||
|
||||
@ -2557,11 +2555,10 @@ class core_renderer extends renderer_base {
|
||||
$attributes = array('src' => $src, 'class' => $class, 'width' => $size, 'height' => $size);
|
||||
if (!$userpicture->visibletoscreenreaders) {
|
||||
$alt = '';
|
||||
$attributes['aria-hidden'] = 'true';
|
||||
}
|
||||
$attributes['alt'] = $alt;
|
||||
|
||||
if (!empty($alt)) {
|
||||
$attributes['alt'] = $alt;
|
||||
$attributes['title'] = $alt;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user