Make error messages accessible

This commit is contained in:
Eric Lippmann 2016-01-25 07:44:48 +01:00
parent 2e1e0bb89f
commit ec177e78e5
3 changed files with 21 additions and 10 deletions

View File

@ -3,7 +3,6 @@
namespace Icinga\Controllers;
use Icinga\Web\Response\JsonResponse;
use Zend_Controller_Plugin_ErrorHandler;
use Icinga\Application\Icinga;
use Icinga\Application\Logger;
@ -13,6 +12,7 @@ use Icinga\Exception\Http\HttpNotFoundException;
use Icinga\Exception\MissingParameterException;
use Icinga\Security\SecurityException;
use Icinga\Web\Controller\ActionController;
use Icinga\Web\Url;
/**
* Application wide controller for displaying exceptions
@ -100,6 +100,15 @@ class ErrorController extends ActionController
}
$this->view->request = $error->request;
$this->view->hideControls = ! $isAuthenticated;
if (! $isAuthenticated) {
$this->view->hideControls = true;
} else {
$this->view->hideControls = false;
$this->getTabs()->add('error', array(
'active' => true,
'label' => $this->translate('Error'),
'url' => Url::fromRequest()
));
}
}
}

View File

@ -1,12 +1,12 @@
<?php if (! $this->compact && ! $hideControls): ?>
<div class="controls">
<?= $tabs->showOnlyCloseButton() ?>
<?= $tabs ?>
</div>
<?php endif ?>
<div class="content">
<p class="autofocus error-message"><?= nl2br($this->escape($message)) ?></p>
<?php if (isset($stackTrace)): ?>
<hr />
<pre><?= $this->escape($stackTrace) ?></pre>
<?php endif ?>
<p tabindex="-1" class="autofocus error-message"><?= nl2br($this->escape($message)) ?></p>
<?php if (isset($stackTrace)): ?>
<hr>
<pre><?= $this->escape($stackTrace) ?></pre>
<?php endif ?>
</div>

View File

@ -113,8 +113,10 @@
background-color: @gray-lighter;
}
.container {
// Don't outline containers when focused because they receive focus for accessibility only programmatically
.container,
.error-message {
// Don't outline containers and error messages when focused because they receive focus for accessibility only
// programmatically
outline: none;
}