From 020756e0f12e1e710fc1931c3aebec5a5597587d Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 20:59:13 +0800 Subject: [PATCH] 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 --- mod/quiz/classes/output/edit_renderer.php | 5 ++--- mod/quiz/tests/behat/editing_add.feature | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mod/quiz/classes/output/edit_renderer.php b/mod/quiz/classes/output/edit_renderer.php index ef3b7301628..d46ba4e3dcb 100644 --- a/mod/quiz/classes/output/edit_renderer.php +++ b/mod/quiz/classes/output/edit_renderer.php @@ -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 = [ diff --git a/mod/quiz/tests/behat/editing_add.feature b/mod/quiz/tests/behat/editing_add.feature index 639ba3bebb8..b1774b5109a 100644 --- a/mod/quiz/tests/behat/editing_add.feature +++ b/mod/quiz/tests/behat/editing_add.feature @@ -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