MDL-70829 mod_quiz: Mark up decorative images properly

* Decorative images should have an empty alt text and there's no need
to set a presentation role.
* Accessibility Behat tests added to cover the changes
This commit is contained in:
Jun Pataleta
2024-04-12 10:42:11 +08:00
parent 04ec43be5e
commit 020756e0f1
2 changed files with 18 additions and 3 deletions
+2 -3
View File
@@ -1034,7 +1034,7 @@ class edit_renderer extends \plugin_renderer_base {
$namestr = $qtype->local_name();
$icon = $this->pix_icon('icon', $namestr, $qtype->plugin_name(), ['title' => $namestr,
'class' => 'activityicon', 'alt' => ' ', 'role' => 'presentation']);
'class' => 'activityicon', 'alt' => $namestr]);
$editicon = $this->pix_icon('t/edit', '', 'moodle', ['title' => '']);
@@ -1072,8 +1072,7 @@ class edit_renderer extends \plugin_renderer_base {
$configuretitle = get_string('configurerandomquestion', 'quiz');
$qtype = \question_bank::get_qtype($question->qtype, false);
$namestr = $qtype->local_name();
$icon = $this->pix_icon('icon', $namestr, $qtype->plugin_name(), ['title' => $namestr,
'class' => 'icon activityicon', 'alt' => ' ', 'role' => 'presentation']);
$icon = $this->pix_icon('icon', $namestr, $qtype->plugin_name(), ['class' => 'icon activityicon']);
$editicon = $this->pix_icon('t/edit', $configuretitle, 'moodle', ['title' => '']);
$qbankurlparams = [
+16
View File
@@ -236,3 +236,19 @@ Feature: Edit quiz page - adding things
And I should see "Essay 02" on quiz page "3"
And I should see "Random" on quiz page "4"
And I should see "Essay for page 4" on quiz page "4"
@accessibility @javascript
Scenario: Check the accessibility of the quiz questions page
Given the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | truefalse | First question | Answer the first question |
| Test questions | truefalse | Other question | Answer the first question |
And quiz "Quiz 1" contains the following questions:
| question | page |
| First question | 1 |
When I reload the page
Then I should see "First question"
And the page should meet accessibility standards