diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index c5b635e1ab4..b34adcb162f 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -2524,9 +2524,16 @@ class core_renderer extends renderer_base { $src = $userpicture->get_url($this->page, $this); - $attributes = array('src'=>$src, 'alt'=>$alt, 'title'=>$alt, 'class'=>$class, 'width'=>$size, 'height'=>$size); + $attributes = array('src' => $src, 'class' => $class, 'width' => $size, 'height' => $size); if (!$userpicture->visibletoscreenreaders) { $attributes['role'] = 'presentation'; + $alt = ''; + $attributes['aria-hidden'] = 'true'; + } + + if (!empty($alt)) { + $attributes['alt'] = $alt; + $attributes['title'] = $alt; } // get the image html output fisrt