Skip to content

Commit

Permalink
MDL-68355 gradingform_guide: Fix accessibility issues
Browse files Browse the repository at this point in the history
* Add sr-only label for criterion information.
* Add sr-only label for frequently used comments picker button.
* Removed unused string grade_help.
* Fixed tags for hidden help texts, changing them from <small> to <span>
* Added aria-label for the score and additional comments fields so that
  the user would know which criterion they are currently working on.
* Added score_help and remark_help lang strings for more description
  for the score and additional comments fields.
* Remove text-muted class for additional comments' field label to avoid
  colour contrast issues.
  • Loading branch information
junpataleta committed Apr 9, 2020
1 parent de7c779 commit 706f17d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions grade/grading/form/guide/lang/en/gradingform_guide.php
Expand Up @@ -26,13 +26,15 @@

$string['addcomment'] = 'Add frequently used comment';
$string['additionalcomments'] = 'Additional comments';
$string['additionalcommentsforcriterion'] = 'Additional comments for criterion, {$a}';
$string['addcriterion'] = 'Add criterion';
$string['alwaysshowdefinition'] = 'Show guide definition to students';
$string['backtoediting'] = 'Back to editing';
$string['clicktocopy'] = 'Click to copy this text into the criteria feedback';
$string['clicktoedit'] = 'Click to edit';
$string['clicktoeditname'] = 'Click to edit criterion name';
$string['comment'] = 'Comment';
$string['commentpickerforcriterion'] = 'Frequently used comments picker for criterion, {$a}';
$string['comments'] = 'Frequently used comments';
$string['commentsdelete'] = 'Delete comment';
$string['commentsempty'] = 'Click to edit comment';
Expand Down Expand Up @@ -70,6 +72,7 @@
$string['guidestatus'] = 'Current marking guide status';
$string['hidemarkerdesc'] = 'Hide marker criterion descriptions';
$string['hidestudentdesc'] = 'Hide student criterion descriptions';
$string['informationforcriterion'] = 'Information for criterion, {$a}';
$string['insertcomment'] = 'Insert frequently used comment';
$string['maxscore'] = 'Maximum score';
$string['name'] = 'Name';
Expand All @@ -88,11 +91,14 @@
$string['regrademessage5'] = 'You are about to save significant changes to a marking guide that has already been used for grading. The gradebook value will be unchanged, but the marking guide will be hidden from students until their item is regraded.';
$string['regradeoption0'] = 'Do not mark for regrade';
$string['regradeoption1'] = 'Mark for regrade';
$string['remark_help'] = 'Enter any additional comments that you would like to provide related to the grade for this criterion. You may also pick from the list of frequently used comments using the frequently used comments picker button.';
$string['restoredfromdraft'] = 'NOTE: The last attempt to grade this person was not saved properly so draft grades have been restored. If you want to cancel these changes use the \'Cancel\' button below.';
$string['save'] = 'Save';
$string['saveguide'] = 'Save marking guide and make it ready';
$string['saveguidedraft'] = 'Save as draft';
$string['score'] = 'score';
$string['scoreforcriterion'] = 'Score for criterion, {$a}';
$string['score_help'] = 'Enter a score for the criterion, {$a->criterion}. Ensure that this is a number between 0 and {$a->maxscore}.';
$string['showmarkerdesc'] = 'Show marker criterion descriptions';
$string['showmarkspercriterionstudents'] = 'Show marks per criterion to students';
$string['showstudentdesc'] = 'Show student criterion descriptions';
Expand Up @@ -73,6 +73,7 @@
type="button"
>
{{# pix }} info, gradingform_guide {{/ pix }}
<span class="sr-only">{{#str}}informationforcriterion, gradingform_guide, {{name}}{{/str}}</span>
</button>
<button class="criterion-toggle btn btn-icon icon-no-margin text-reset p-0 font-weight-bold mb-0 ml-auto"
type="button"
Expand Down Expand Up @@ -103,16 +104,21 @@
<div class="form-group">
<label for="gradingform_guide-{{uniqid}}-criteria-{{id}}-score">{{#str}}outof, gradingform_guide, {{maxscore}}{{/str}}</label>
<input class="form-control" type="number" name="advancedgrading[criteria][{{id}}][score]" value="{{score}}"
id="gradingform_guide-{{uniqid}}-criteria-{{id}}-score"
aria-describedby="gradingform_guide-{{uniqid}}-help-{{id}}-score">
<small id="gradingform_guide-{{uniqid}}-help-{{id}}-score" class="sr-only">{{#str}}grade_help, gradingform_guide{{/str}}</small>
id="gradingform_guide-{{uniqid}}-criteria-{{id}}-score"
aria-describedby="gradingform_guide-{{uniqid}}-help-{{id}}-score"
min="0" max="{{maxscore}}"
aria-label="{{#str}}scoreforcriterion, gradingform_guide, {{name}}{{/str}}">
<span id="gradingform_guide-{{uniqid}}-help-{{id}}-score" aria-hidden="true" class="sr-only">{{!
}}{{#str}}score_help, gradingform_guide, { "criterion": {{# quote }}{{ name }}{{/ quote }}, "maxscore": {{# quote }}{{ maxscore }}{{/ quote }} }{{/str}}
</span>
</div>
<div class="form-group ">
<label class="text-muted" for="gradingform_guide-{{uniqid}}-criteria-{{id}}-remark">{{#str}}additionalcomments, gradingform_guide{{/str}}</label>
<label for="gradingform_guide-{{uniqid}}-criteria-{{id}}-remark">{{#str}}additionalcomments, gradingform_guide{{/str}}</label>
<div class="input-group mb-3 form-inset form-inset-right">
<textarea class="form-control" type="text" name="advancedgrading[criteria][{{id}}][remark]"
id="gradingform_guide-{{uniqid}}-criteria-{{id}}-remark"
aria-describedby="gradingform_guide-{{uniqid}}-help-{{id}}-remark"
aria-label="{{#str}}additionalcommentsforcriterion, gradingform_guide, {{name}}{{/str}}"
data-gradingform-guide-role="remark"
rows="2"
data-max-rows="5"
Expand All @@ -128,6 +134,7 @@
type="button"
>
{{#pix}}plus, gradingform_guide{{/pix}}
<span class="sr-only">{{#str}}commentpickerforcriterion, gradingform_guide, {{name}}{{/str}}</span>
</button>
{{/hascomments}}
</div>
Expand All @@ -143,7 +150,7 @@
</div>
</div>
{{/hascomments}}
<small id="gradingform_guide-{{uniqid}}-help-{{id}}-remark" class="sr-only">{{#str}}grade_help, gradingform_guide{{/str}}</small>
<span id="gradingform_guide-{{uniqid}}-help-{{id}}-remark" aria-hidden="true" class="sr-only">{{#str}}remark_help, gradingform_guide{{/str}}</span>
</div>
</div>
</div>
Expand Down

0 comments on commit 706f17d

Please sign in to comment.