Commit 96f95186 authored by Jono Mingard's avatar Jono Mingard
Browse files

Moved required form field asterisks inside labels (Bug 1259393)



Modified pieforms to put the asterisk marking a required form
field inside the label rather than outside to make required
fields accessible to screen readers.
Also reset the font weight for markers so their styling appears
the same.

Change-Id: I8bb5cb8c57c164f5c85392e8988760d0a34aaed3
Signed-off-by: default avatarJono Mingard <reason.koan@gmail.com>
parent 7368636f
......@@ -1404,15 +1404,20 @@ EOF;
// Element title
if (isset($element['title']) && $element['title'] !== '') {
$title = (!empty($element['labelescaped'])) ? $element['title'] : self::hsc($element['title']);
if ($this->get_property('requiredmarker') && !empty($element['rules']['required'])) {
$requiredmarker = ' <span class="requiredmarker">*</span>';
}
else {
$requiredmarker = '';
}
if (!empty($element['nolabel'])) {
// Don't bother with a label for the element
$element['labelhtml'] = $title;
$element['labelhtml'] = $title . $requiredmarker;
}
else {
$element['labelhtml'] = '<label for="' . $this->name . '_' . $element['id'] . '">' . $title . '</label>';
}
if ($this->get_property('requiredmarker') && !empty($element['rules']['required'])) {
$element['labelhtml'] .= ' <span class="requiredmarker">*</span>';
$element['labelhtml'] = '<label for="' . $this->name . '_' . $element['id'] . '">' . $title . $requiredmarker . '</label>';
}
}
......
......@@ -538,6 +538,7 @@ form {
/* required */
.requiredmarker {
color: #FF0000;
font-weight: normal;
}
/* description */
.pieform td.description {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment