MDL-13983 show frozen radio buttons in a more accessible way.

This commit is contained in:
Rod Norfor 2011-03-08 18:04:24 +00:00 committed by Tim Hunt
parent c09604234a
commit 1e668c4d85

View file

@ -66,6 +66,21 @@ class MoodleQuickForm_radio extends HTML_QuickForm_radio{
return 'default'; return 'default';
} }
} }
/**
* Returns the disabled field. Accessibility: the return "( )" from parent
* class is not acceptable for screenreader users, and we DO want a label.
* @return string
*/
function getFrozenHtml()
{
$output = '<input type="radio" disabled="disabled" id="'.$this->getAttribute('id').'" ';
if ($this->getChecked()) {
$output .= 'checked="checked" />'.$this->_getPersistantData();
} else {
$output .= '/>';
}
return $output;
}
function toHtml() function toHtml()
{ {
return '<span>' . parent::toHtml() . '</span>'; return '<span>' . parent::toHtml() . '</span>';