Skip to content

Commit

Permalink
MDL-70829 mod_quiz: Mark up decorative images properly
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
junpataleta committed Apr 12, 2024
1 parent 04ec43b commit 020756e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mod/quiz/classes/output/edit_renderer.php
Expand Up @@ -1034,7 +1034,7 @@ public function question_name(structure $structure, $slot, $pageurl) {
$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' => '']);

Expand Down Expand Up @@ -1072,8 +1072,7 @@ public function random_question(structure $structure, $slotnumber, $pageurl) {
$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 = [
Expand Down
16 changes: 16 additions & 0 deletions mod/quiz/tests/behat/editing_add.feature
Expand Up @@ -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

0 comments on commit 020756e

Please sign in to comment.