MDL-80469 forms: add a hidden label to the button action group

This is a temporary solution to the accessibility problem
"Fieldsets without legend". We will no longer use a fieldset tag
if there is no legend after MDL-80431
This commit is contained in:
Marina Glancy
2024-04-11 12:56:24 +01:00
parent c9fe574fdd
commit 6e5d277fc2
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -410,7 +410,8 @@ class course_edit_form extends moodleform {
}
$buttonarray[] = &$mform->createElement('submit', 'saveanddisplay', get_string('savechangesanddisplay'), $classarray);
$buttonarray[] = &$mform->createElement('cancel');
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$grp = $mform->addGroup($buttonarray, 'buttonar', get_string('formactions', 'core_form'), array(' '), false);
$grp->setHiddenLabel(true);
$mform->closeHeaderBefore('buttonar');
$mform->addElement('hidden', 'id', null);
+2 -1
View File
@@ -1054,7 +1054,8 @@ abstract class moodleform_mod extends moodleform {
$buttonarray[] = &$mform->createElement('cancel');
}
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$grp = $mform->addGroup($buttonarray, 'buttonar', get_string('formactions', 'form'), array(' '), false);
$grp->setHiddenLabel(true);
$mform->setType('buttonar', PARAM_RAW);
}
+2 -1
View File
@@ -1380,7 +1380,8 @@ abstract class moodleform {
$mform->createElement('cancel'),
];
$buttonarname = $forceuniqueid && $this::$uniqueid > 0 ? 'buttonar_' . $this::$uniqueid : 'buttonar';
$mform->addGroup($buttonarray, $buttonarname, '', [' '], false);
$grp = $mform->addGroup($buttonarray, $buttonarname, get_string('formactions', 'core_form'), [' '], false);
$grp->setHiddenLabel(true);
$mform->closeHeaderBefore('buttonar');
} else {
// No group needed.