mirror of
https://github.com/Icinga/icingaweb2.git
synced 2026-06-03 13:43:35 -04:00
Add an asterisk suffix to a form element's label if its required
The screen reader part "(required)" is not being considered with this commit as most screen readers do not need this due to the ARIA and HTML5 property. resolves #7934
This commit is contained in:
parent
4351603243
commit
0111fdf78e
1 changed files with 5 additions and 0 deletions
|
|
@ -583,6 +583,11 @@ class Form extends Zend_Form
|
|||
if ($element->isRequired() && strpos(strtolower($element->getType()), 'checkbox') === false) {
|
||||
$element->setAttrib('aria-required', 'true'); // ARIA
|
||||
$element->setAttrib('required', ''); // HTML5
|
||||
if (($label = $element->getDecorator('label')) !== false) {
|
||||
$element->setLabel($this->getView()->escape($element->getLabel()));
|
||||
$label->setOption('escape', false);
|
||||
$label->setOption('requiredSuffix', ' <span aria-hidden="true">*</span>');
|
||||
}
|
||||
}
|
||||
|
||||
return $element;
|
||||
|
|
|
|||
Loading…
Reference in a new issue