From 5289581d06d9b596976984808a4bf805f802d8a5 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 19:50:19 +0800 Subject: [PATCH 01/15] MDL-70829 core: Remove presentation role for decorative images * An image with non-empty alt text should not have a presentation role. * An empty alt attribute is sufficient for decorative images. No need to add a presentation role for them. * Additionally, if there is already text that is present for an image, there's no need to add an alt text with the same text. Such images are decorative and should just have an empty alt text. --- lib/adminlib.php | 2 +- lib/outputrenderers.php | 7 +++---- lib/tests/weblib_test.php | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/adminlib.php b/lib/adminlib.php index ed0ec215a95..b74788ad339 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -11067,7 +11067,7 @@ class admin_setting_php_extension_enabled extends admin_setting { $o = ''; if (!extension_loaded($this->extension)) { - $warning = $OUTPUT->pix_icon('i/warning', '', '', array('role' => 'presentation')) . ' ' . $this->description; + $warning = $OUTPUT->pix_icon('i/warning', '') . ' ' . $this->description; $o .= format_admin_setting($this, $this->visiblename, $warning); } diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 0fef2261c53..45b2dccd752 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -2362,7 +2362,7 @@ class core_renderer extends renderer_base { public function doc_link($path, $text = '', $forcepopup = false, array $attributes = []) { global $CFG; - $icon = $this->pix_icon('book', '', 'moodle', array('class' => 'iconhelp icon-pre', 'role' => 'presentation')); + $icon = $this->pix_icon('book', '', 'moodle', array('class' => 'iconhelp icon-pre')); $attributes['href'] = new moodle_url(get_docs_url($path)); $newwindowicon = ''; @@ -4656,15 +4656,14 @@ EOD; if ($button['buttontype'] === 'message') { \core_message\helper::messageuser_requirejs(); } - $image = $this->pix_icon($button['formattedimage'], $button['title'], 'moodle', array( + $image = $this->pix_icon($button['formattedimage'], '', 'moodle', array( 'class' => 'iconsmall', - 'role' => 'presentation' )); $image .= html_writer::span($button['title'], 'header-button-title'); } else { $image = html_writer::empty_tag('img', array( 'src' => $button['formattedimage'], - 'role' => 'presentation' + 'alt' => $button['title'], )); } $html .= html_writer::link($button['url'], html_writer::tag('span', $image), $button['linkattributes']); diff --git a/lib/tests/weblib_test.php b/lib/tests/weblib_test.php index 263e5a42005..1ecc422e2c7 100644 --- a/lib/tests/weblib_test.php +++ b/lib/tests/weblib_test.php @@ -1095,9 +1095,9 @@ EXPECTED; $url1 = "{$CFG->wwwroot}/draftfile.php/5/user/draft/99999999/test1.jpg"; $url2 = "{$CFG->wwwroot}/draftfile.php/5/user/draft/99999998/test2.jpg"; - $html = "

This is a test.

\"\"

+ $html = "

This is a test.

\"\"


Test content.

\"\"

"; + class=\"img-fluid atto_image_button_text-bottom\">

"; $draftareas = array( array( 'urlbase' => 'draftfile.php', From 31b4e4c7a047b93593a2b2f18823cbca242fcf5b Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 20:26:26 +0800 Subject: [PATCH 02/15] MDL-70829 tool_lp: Remove presentation role for decorative images * Behat tests in report_competency added to test the user summary display in the user competency summary modal. --- .../lp/templates/form-user-selector-suggestion.mustache | 2 +- admin/tool/lp/templates/user_summary.mustache | 2 +- .../competency/tests/behat/breakdown_by_activity.feature | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/admin/tool/lp/templates/form-user-selector-suggestion.mustache b/admin/tool/lp/templates/form-user-selector-suggestion.mustache index 61557f9ab1f..015cfda9487 100644 --- a/admin/tool/lp/templates/form-user-selector-suggestion.mustache +++ b/admin/tool/lp/templates/form-user-selector-suggestion.mustache @@ -49,7 +49,7 @@ } }} - + {{fullname}} {{#hasidentity}} {{identity}} diff --git a/admin/tool/lp/templates/user_summary.mustache b/admin/tool/lp/templates/user_summary.mustache index dbcf6397eb9..598f23f9530 100644 --- a/admin/tool/lp/templates/user_summary.mustache +++ b/admin/tool/lp/templates/user_summary.mustache @@ -50,7 +50,7 @@ }} - + {{fullname}} {{#hasidentity}} {{identity}} diff --git a/report/competency/tests/behat/breakdown_by_activity.feature b/report/competency/tests/behat/breakdown_by_activity.feature index fb7746f2b5d..bc050c5d102 100644 --- a/report/competency/tests/behat/breakdown_by_activity.feature +++ b/report/competency/tests/behat/breakdown_by_activity.feature @@ -65,3 +65,10 @@ Feature: See the competencies for an activity And I click on "PageName1" "autocomplete_selection" And I should see "Test-Comp1" And I should see "Test-Comp2" + + @accessibility + Scenario: Evaluate the accessibility of the user competency summary dialogue + Given I navigate to "Reports" in current page administration + When I click on "Competency breakdown" "link" + And I click on "Not rated" "link" + And the page should meet accessibility standards From cfcf79499b516b3c18867e44730dbd1ccff5936b Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 20:39:35 +0800 Subject: [PATCH 03/15] MDL-70829 block_myoverview: Mark up decorative image properly * The zero state image is purely decorative so there's no need to set a non-empty alt text for it. * The presentation role is also unnecessary for decorative image with empty alt. * Accessibility Behat tests added to cover changes --- blocks/myoverview/templates/zero-state.mustache | 3 +-- .../tests/behat/block_myoverview_zerostate.feature | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/blocks/myoverview/templates/zero-state.mustache b/blocks/myoverview/templates/zero-state.mustache index 494c0621b8a..b719518362c 100644 --- a/blocks/myoverview/templates/zero-state.mustache +++ b/blocks/myoverview/templates/zero-state.mustache @@ -51,8 +51,7 @@
{{{ title }}}
{{{ title }}}

{{{ intro }}}

diff --git a/blocks/myoverview/tests/behat/block_myoverview_zerostate.feature b/blocks/myoverview/tests/behat/block_myoverview_zerostate.feature index 4eda8ae1778..79cece88b26 100644 --- a/blocks/myoverview/tests/behat/block_myoverview_zerostate.feature +++ b/blocks/myoverview/tests/behat/block_myoverview_zerostate.feature @@ -70,3 +70,8 @@ Feature: Zero state on my overview block And "Create course" "button" should exist And I click on "Create course" "button" And I should see "Add a new course" + + @accessibility + Scenario: Evaluate the accessibility of the My courses (zero state) + When I am on the "My courses" page logged in as "manager" + Then the page should meet accessibility standards From eb38033024872155598d860c89f553f59d7bb5df Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 20:41:04 +0800 Subject: [PATCH 04/15] MDL-70829 block_recentlyaccesseditems: Mark up decorative image properly * The zero state image is purely decorative so there's no need to set a non-empty alt text for it. * The presentation role is also unnecessary for decorative image with empty alt. * Accessibility Behat tests added to cover changes --- blocks/recentlyaccesseditems/templates/no-items.mustache | 5 ++--- .../behat/block_recentlyaccesseditems_dashboard.feature | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/blocks/recentlyaccesseditems/templates/no-items.mustache b/blocks/recentlyaccesseditems/templates/no-items.mustache index 83ef42afd38..a104252de80 100644 --- a/blocks/recentlyaccesseditems/templates/no-items.mustache +++ b/blocks/recentlyaccesseditems/templates/no-items.mustache @@ -27,9 +27,8 @@
{{#str}} noitems, block_recentlyaccesseditems {{/str}}

{{#str}} noitems, block_recentlyaccesseditems {{/str}}

-
\ No newline at end of file +
diff --git a/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature b/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature index bdcec5ffc05..c0a598b2e99 100644 --- a/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature +++ b/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature @@ -23,15 +23,19 @@ Feature: The recently accessed items block allows users to easily access their m | name | Test forum name | And I log in as "student1" + @accessibility Scenario: User has not accessed any item Then I should see "No recent items" in the "Recently accessed items" "block" + And the page should meet accessibility standards + @accessibility Scenario: User has accessed some items Given I change window size to "large" When I am on the "Test forum name" "forum activity" page And I follow "Dashboard" Then I should see "Test forum name" in the "Recently accessed items" "block" And I should not see "Show more items" in the "Recently accessed items" "block" + And the page should meet accessibility standards Scenario: User has accessed more than 3 items Given the following "activities" exist: From 91837d0553d4987cf703338d97cc50a09a988e76 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 20:55:31 +0800 Subject: [PATCH 05/15] MDL-70829 course: 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: - block_starredcourses uses the core_course/no-courses template - core_completion tests changes in core_course/activity instance and core_course/editdefaultcompletion --- .../tests/behat/starred_courses.feature | 42 +++++++++++++++++++ .../bulk_edit_activity_completion.feature | 7 ++++ .../behat/default_activity_completion.feature | 7 ++++ course/renderer.php | 2 +- course/templates/activityinstance.mustache | 2 +- .../templates/editdefaultcompletion.mustache | 2 +- course/templates/no-courses.mustache | 5 +-- 7 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 blocks/starredcourses/tests/behat/starred_courses.feature diff --git a/blocks/starredcourses/tests/behat/starred_courses.feature b/blocks/starredcourses/tests/behat/starred_courses.feature new file mode 100644 index 00000000000..6bd79d414db --- /dev/null +++ b/blocks/starredcourses/tests/behat/starred_courses.feature @@ -0,0 +1,42 @@ +@block_starredcourses +Feature: Starred courses + In order for me to quickly navigate to my favourite courses + As a user + I must be able to add them to the Starred courses block + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@example.com | + And the following "courses" exist: + | shortname | fullname | + | C1 | Course 1 | + | C2 | Course 2 | + | C3 | Course 3 | + And the following "course enrolments" exist: + | user | course | role | + | student1 | C1 | student | + | student1 | C2 | student | + | student1 | C3 | student | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | starredcourses | User | student1 | my-index | content | + + @accessibility @javascript + Scenario: User has no starred courses + Given I log in as "student1" + Then I should see "No starred courses" + And the page should meet accessibility standards + + @accessibility @javascript + Scenario: User has starred courses + Given I am on the "My courses" page logged in as "student1" + And I click on "Actions for course Course 1" "button" + And I click on "Star for Course 1" "link" + And I click on "Actions for course Course 3" "button" + And I click on "Star for Course 3" "link" + When I follow "Dashboard" + Then the page should meet accessibility standards + And I should see "Course 1" in the "Starred courses" "block" + And I should see "Course 3" in the "Starred courses" "block" + But I should not see "Course 2" in the "Starred courses" "block" diff --git a/completion/tests/behat/bulk_edit_activity_completion.feature b/completion/tests/behat/bulk_edit_activity_completion.feature index 41008a22efb..c9639c2e309 100644 --- a/completion/tests/behat/bulk_edit_activity_completion.feature +++ b/completion/tests/behat/bulk_edit_activity_completion.feature @@ -78,3 +78,10 @@ Feature: Allow teachers to bulk edit activity completion rules in a course. And I should see "With conditions" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment two']]" "xpath_element" And I should see "Passing grade" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment two']]" "xpath_element" And I should not see "Completion expected on" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment two']]" "xpath_element" + + @accessibility + Scenario: Evaluate the accessibility of the bulk edit activity completion page + Given I am on the "Course 1" course page logged in as "teacher1" + When I navigate to "Course completion" in current page administration + And I set the field "Course completion tertiary navigation" to "Bulk edit activity completion" + And the page should meet accessibility standards diff --git a/completion/tests/behat/default_activity_completion.feature b/completion/tests/behat/default_activity_completion.feature index 86790234873..1d203700168 100644 --- a/completion/tests/behat/default_activity_completion.feature +++ b/completion/tests/behat/default_activity_completion.feature @@ -228,3 +228,10 @@ Feature: Allow teachers to edit the default activity completion rules in a cours When I navigate to "Course completion" in current page administration And I set the field "Course completion tertiary navigation" to "Default activity completion" Then "Quiz" "text" should appear before "Text and media area" "text" + + @accessibility + Scenario: Evaluate the accessibility of the default activity completion page + Given I am on the "Course 1" course page logged in as "teacher1" + When I navigate to "Course completion" in current page administration + And I set the field "Course completion tertiary navigation" to "Default activity completion" + And the page should meet accessibility standards diff --git a/course/renderer.php b/course/renderer.php index 53567541b14..47992ebd192 100644 --- a/course/renderer.php +++ b/course/renderer.php @@ -378,7 +378,7 @@ class core_course_renderer extends plugin_renderer_base { $altname = get_accesshide(' ' . $cm->modfullname); $name = html_writer::empty_tag('img', array('src' => $cm->get_icon_url(), - 'class' => 'iconlarge activityicon', 'alt' => ' ', 'role' => 'presentation')) . + 'class' => 'iconlarge activityicon', 'alt' => '')) . html_writer::tag('span', ' '.$cm->get_formatted_name() . $altname, array('class' => 'instancename')); $formattedinfo = \core_availability\info::format_info($cm->availableinfo, $cm->get_course()); return html_writer::div($name, 'activityinstance-error') . diff --git a/course/templates/activityinstance.mustache b/course/templates/activityinstance.mustache index 86a32a7384b..d1af70a3a4d 100644 --- a/course/templates/activityinstance.mustache +++ b/course/templates/activityinstance.mustache @@ -42,7 +42,7 @@ {{/canmanage}}
-  + {{{modname}}} diff --git a/course/templates/editdefaultcompletion.mustache b/course/templates/editdefaultcompletion.mustache index 30f0c519619..22000de085a 100644 --- a/course/templates/editdefaultcompletion.mustache +++ b/course/templates/editdefaultcompletion.mustache @@ -38,7 +38,7 @@
{{#modules}}
-  + {{{formattedname}}}
{{/modules}} diff --git a/course/templates/no-courses.mustache b/course/templates/no-courses.mustache index 1b7007a5128..90a8ce7363a 100644 --- a/course/templates/no-courses.mustache +++ b/course/templates/no-courses.mustache @@ -28,10 +28,9 @@
{{$nocoursestring}}{{#str}} nocourses, core {{/str}}{{/nocoursestring}} + alt="">

{{$nocoursestring}}{{#str}} nocourses, core {{/str}}{{/nocoursestring}}

{{#newcourseurl}} {{#str}} createnewcourse, core {{/str}} {{/newcourseurl}} -
\ No newline at end of file +
From 04ec43be5e244927a24bde4bf7ed8132ada480ab Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 20:58:27 +0800 Subject: [PATCH 06/15] MDL-70829 mod_data: 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/data/templates/view_noentries.mustache | 8 +------- mod/data/templates/zero_state.mustache | 7 +------ mod/data/tests/behat/view_entries.feature | 15 +++++++++++++++ mod/data/tests/behat/zero_state.feature | 6 ++++++ 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/mod/data/templates/view_noentries.mustache b/mod/data/templates/view_noentries.mustache index ae3a196f707..5a0fc957819 100644 --- a/mod/data/templates/view_noentries.mustache +++ b/mod/data/templates/view_noentries.mustache @@ -55,14 +55,8 @@ } }}
- {{#str}} norecords, mod_data {{/str}} +
{{#str}} norecords, mod_data {{/str}}
-
{{#importentriesbutton}} {{> core/single_button }} diff --git a/mod/data/templates/zero_state.mustache b/mod/data/templates/zero_state.mustache index fd65758acd1..deb4543fde0 100644 --- a/mod/data/templates/zero_state.mustache +++ b/mod/data/templates/zero_state.mustache @@ -71,12 +71,7 @@ } }}
- {{{ title }}} +
{{{ title }}}
{{#intro}}

{{{ intro }}}

diff --git a/mod/data/tests/behat/view_entries.feature b/mod/data/tests/behat/view_entries.feature index 52e02874763..4ee31d83996 100644 --- a/mod/data/tests/behat/view_entries.feature +++ b/mod/data/tests/behat/view_entries.feature @@ -183,3 +183,18 @@ Feature: Users can view and search database entries | param1 | param3 | autolink | | 0 | 0 | should not | | 1 | 1 | should | + + @javascript @accessibility + Scenario: Check the accessibility of the database entries page (zero state) + When I am on the "Test database name" "data activity" page logged in as "teacher1" + Then I should see "No entries yet" + And the page should meet accessibility standards + + @javascript @accessibility + Scenario: Check the accessibility of the database entries page + Given the following "mod_data > entries" exist: + | database | user | Test field name | Test field 2 name | Test field 3 name | + | data1 | student1 | Student entry 1 | Some student content 1 | http://moodle.com | + | data1 | teacher1 | Teacher entry 2 | Some teacher content 2 | http://moodle.com | + When I am on the "Test database name" "data activity" page logged in as teacher1 + Then the page should meet accessibility standards diff --git a/mod/data/tests/behat/zero_state.feature b/mod/data/tests/behat/zero_state.feature index 4d5b385d40f..8ee696ce343 100644 --- a/mod/data/tests/behat/zero_state.feature +++ b/mod/data/tests/behat/zero_state.feature @@ -65,3 +65,9 @@ Feature: Zero state page (no fields created) Then I click on "Use this preset" "button" And I should not see "Field mappings" And I should see "Image" in the "image" "table_row" + + @javascript @accessibility + Scenario: Check the accessibility of the database activity zero state + When I am on the "Test database name" "data activity" page logged in as "teacher1" + Then I should see "Start building your activity" + And the page should meet accessibility standards From 020756e0f12e1e710fc1931c3aebec5a5597587d Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 20:59:13 +0800 Subject: [PATCH 07/15] 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 From 013d68a7ad33c91ed10b6e54505ce7a79395b44f Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 21:00:29 +0800 Subject: [PATCH 08/15] MDL-70829 mod_workshop: Mark up decorative images properly * Decorative images should have an empty alt text and there's no need to set a presentation role. --- mod/workshop/renderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/workshop/renderer.php b/mod/workshop/renderer.php index 3fe01e6ef52..20ef24637aa 100644 --- a/mod/workshop/renderer.php +++ b/mod/workshop/renderer.php @@ -308,7 +308,7 @@ class mod_workshop_renderer extends plugin_renderer_base { if ($phase->active) { // Mark the section as the current one. - $icon = $this->output->pix_icon('i/marked', '', 'moodle', ['role' => 'presentation']); + $icon = $this->output->pix_icon('i/marked', ''); $actions .= get_string('userplancurrentphase', 'workshop').' '.$icon; } else { From 02344990356560f6bb0d4cfb9af38748cde614a3 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 21:05:48 +0800 Subject: [PATCH 09/15] MDL-70829 enrol_manual: Mark up decorative image properly * An empty alt text is enough for decorative images. There's no need to set a presentation role. --- enrol/manual/templates/form-user-selector-suggestion.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enrol/manual/templates/form-user-selector-suggestion.mustache b/enrol/manual/templates/form-user-selector-suggestion.mustache index ab9b862b0ad..91d288d3233 100644 --- a/enrol/manual/templates/form-user-selector-suggestion.mustache +++ b/enrol/manual/templates/form-user-selector-suggestion.mustache @@ -49,7 +49,7 @@ } }} - + {{fullname}} {{#hasidentity}} {{identity}} From b353535c0e72c59415925c7b5d438585c62dcbc9 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 21:07:56 +0800 Subject: [PATCH 10/15] MDL-70829 core_search: Mark up decorative image properly * An empty alt text is enough for decorative images. There's no need to set a presentation role. --- search/templates/form-user-selector-suggestion.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/search/templates/form-user-selector-suggestion.mustache b/search/templates/form-user-selector-suggestion.mustache index 08a5912470a..f3d5407f734 100644 --- a/search/templates/form-user-selector-suggestion.mustache +++ b/search/templates/form-user-selector-suggestion.mustache @@ -36,6 +36,6 @@ } }} - + {{fullname}} From 49a37d198eacd201cfa53d069f4e08f357534091 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 21:15:15 +0800 Subject: [PATCH 11/15] MDL-70829 theme_boost: Make context header icons decorative The non-empty alt text for the icons of the context header buttons like the "Message" and the "Add contact" buttons cause redundant information to be read twice by screen readers when the buttons are rendered with the icon and the button name. The icons need to be set as decorative by setting an empty alt text for them. * The presentation role is also unnecessary. * The alt text is needed when the button gets rendered without the button name text. --- message/templates/add_contact_button.mustache | 9 +++++++-- message/templates/remove_contact_button.mustache | 9 +++++++-- message/tests/behat/self_conversation.feature | 2 +- theme/boost/classes/output/core_renderer.php | 5 ++--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/message/templates/add_contact_button.mustache b/message/templates/add_contact_button.mustache index f4972a58d98..b26ebf427be 100644 --- a/message/templates/add_contact_button.mustache +++ b/message/templates/add_contact_button.mustache @@ -28,7 +28,12 @@ } }} - {{#pix}} t/addcontact, core, {{#str}} addtoyourcontacts, message {{/str}} {{/pix}} - {{#displaytextlabel}}{{#str}} addtoyourcontacts, message {{/str}}{{/displaytextlabel}} + {{^displaytextlabel}} + {{#pix}} t/addcontact, core, {{#str}} addtoyourcontacts, message {{/str}} {{/pix}} + {{/displaytextlabel}} + {{#displaytextlabel}} + {{#pix}} t/addcontact, core {{/pix}} + {{#str}} addtoyourcontacts, message {{/str}} + {{/displaytextlabel}} {{> core/loading }} diff --git a/message/templates/remove_contact_button.mustache b/message/templates/remove_contact_button.mustache index 4373be4beb0..53800467ae8 100644 --- a/message/templates/remove_contact_button.mustache +++ b/message/templates/remove_contact_button.mustache @@ -28,7 +28,12 @@ } }} - {{#pix}} t/removecontact, core, {{#str}} removefromyourcontacts, message {{/str}} {{/pix}} - {{#displaytextlabel}}{{#str}} removefromyourcontacts, message {{/str}}{{/displaytextlabel}} + {{^displaytextlabel}} + {{#pix}} t/removecontact, core, {{#str}} removefromyourcontacts, message {{/str}} {{/pix}} + {{/displaytextlabel}} + {{#displaytextlabel}} + {{#pix}} t/removecontact, core {{/pix}} + {{#str}} removefromyourcontacts, message {{/str}} + {{/displaytextlabel}} {{> core/loading }} diff --git a/message/tests/behat/self_conversation.feature b/message/tests/behat/self_conversation.feature index ea612d2b6c2..deebd39df4b 100644 --- a/message/tests/behat/self_conversation.feature +++ b/message/tests/behat/self_conversation.feature @@ -61,7 +61,7 @@ Feature: Self conversation Given I log in as "student1" When I follow "Profile" in the user menu Then I should see "Message" - And I click on "Message" "icon" + And I press "Message" And I send "Hi!" message in the message area And I should see "Hi!" in the "Student 1" "core_message > Message conversation" And I should see "##today##%d %B##" in the "Student 1" "core_message > Message conversation" diff --git a/theme/boost/classes/output/core_renderer.php b/theme/boost/classes/output/core_renderer.php index 95cf185088c..38ea3b9852f 100644 --- a/theme/boost/classes/output/core_renderer.php +++ b/theme/boost/classes/output/core_renderer.php @@ -225,15 +225,14 @@ class core_renderer extends \core_renderer { if ($button['buttontype'] === 'message') { \core_message\helper::messageuser_requirejs(); } - $image = $this->pix_icon($button['formattedimage'], $button['title'], 'moodle', array( + $image = $this->pix_icon($button['formattedimage'], '', 'moodle', array( 'class' => 'iconsmall', - 'role' => 'presentation' )); $image .= html_writer::span($button['title'], 'header-button-title'); } else { $image = html_writer::empty_tag('img', array( 'src' => $button['formattedimage'], - 'role' => 'presentation' + 'alt' => $button['title'], )); } $html .= html_writer::link($button['url'], html_writer::tag('span', $image), $button['linkattributes']); From da52f356372103dc8e8601187482ca8ba3e5a393 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 18 Mar 2024 21:17:17 +0800 Subject: [PATCH 12/15] MDL-70829 tool_lp: Add empty alt text for decorative image * The decorative image for the course modules in the user competency summary modal is missing an empty alt text. --- .../lp/templates/user_competency_summary_in_course.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/tool/lp/templates/user_competency_summary_in_course.mustache b/admin/tool/lp/templates/user_competency_summary_in_course.mustache index 4e951135b15..d30a481558a 100644 --- a/admin/tool/lp/templates/user_competency_summary_in_course.mustache +++ b/admin/tool/lp/templates/user_competency_summary_in_course.mustache @@ -49,7 +49,7 @@