monitoring: Make inline pie charts accessible

This commit is contained in:
Eric Lippmann 2016-01-22 13:33:22 +01:00
parent 1682d8dd67
commit bc187d91c5
2 changed files with 4 additions and 4 deletions

View File

@ -74,14 +74,14 @@ class InlinePie extends AbstractWidget
* @var string * @var string
*/ */
private $template =<<<'EOD' private $template =<<<'EOD'
<span sparkType="pie" class="sparkline {class}" {title} sparkSliceColors="[{colors}]" values="{data}"> <span sparkType="pie" class="sparkline {class}" title="{title}" role="img" aria-label="{title}" sparkSliceColors="[{colors}]" values="{data}">
</span> </span>
{noscript} {noscript}
EOD; EOD;
private $noscript =<<<'EOD' private $noscript =<<<'EOD'
<noscript> <noscript>
<img width={size} height={size} class="inlinepie {class}" {title} src="{url}" data-icinga-colors="{colors}" data-icinga-values="{data}"/> <img width={size} height={size} class="inlinepie {class}" title="{title}" role="img" aria-label="{title}" src="{url}" data-icinga-colors="{colors}" data-icinga-values="{data}"/>
</noscript> </noscript>
EOD; EOD;
@ -196,7 +196,7 @@ EOD;
*/ */
public function setTitle($title) public function setTitle($title)
{ {
$this->title = 'title="' . htmlspecialchars($title) . '"'; $this->title = $this->view()->escape($title);
return $this; return $this;
} }

View File

@ -95,7 +95,7 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
if ($compact) { if ($compact) {
$results = array_slice($results, 0, $limit); $results = array_slice($results, 0, $limit);
$title = sprintf($this->view->translate('%d more ...'), $count - $limit); $title = sprintf($this->view->translate('%d more ...'), $count - $limit);
$results[] = '<span title="' . $title . '">...</span>'; $results[] = '<span aria-hidden="true" title="' . $title . '">...</span>';
} else { } else {
$table = array_slice($table, 0, $limit); $table = array_slice($table, 0, $limit);
} }