From f4ec6dcd7b87551a2561ff36b5b642150b6f5566 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Fri, 7 Nov 2025 18:58:08 +0800 Subject: [PATCH 1/2] MDL-86998 message: Fix accessibility issues in notification preferences * Fix missing column heading for the preference column * Fix incorrect label for the toggle controls * Make the preference name a table heading with a row scope so that the toggle controls will be programmatically associated to it. * Apply a col scope for the processor column headings to programmatically associate the toggle controls to their respective columns. --- public/lang/en/message.php | 1 + .../message/templates/notification_preferences.mustache | 8 +++++--- ...tification_preferences_component_notification.mustache | 6 +++--- .../templates/notification_preferences_processor.mustache | 2 +- .../behat/message_manage_notification_preferences.feature | 2 ++ 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/public/lang/en/message.php b/public/lang/en/message.php index 869db5c3a55..15cc6742b37 100644 --- a/public/lang/en/message.php +++ b/public/lang/en/message.php @@ -155,6 +155,7 @@ $string['page-message-x'] = 'Any message pages'; $string['participants'] = 'Participants'; $string['pendingcontactrequests'] = 'There are {$a} pending contact requests'; $string['permitted'] = 'Permitted'; +$string['preference'] = 'Preference'; $string['privacy'] = 'Privacy'; $string['privacy_desc'] = 'You can restrict who can message you'; $string['privacy:metadata:core_favourites'] = 'The conversations starred by the user'; diff --git a/public/message/templates/notification_preferences.mustache b/public/message/templates/notification_preferences.mustache index 58ad3bfde1a..7a28d6002d2 100644 --- a/public/message/templates/notification_preferences.mustache +++ b/public/message/templates/notification_preferences.mustache @@ -69,7 +69,7 @@ } }}
-

{{#str}} notificationpreferences, message {{/str}}

+

{{#str}} notificationpreferences, message {{/str}}

core/loading }}
- +
- + {{#processors}} {{> message/notification_preferences_processor }} {{/processors}} diff --git a/public/message/templates/notification_preferences_component_notification.mustache b/public/message/templates/notification_preferences_component_notification.mustache index 2577f3f4849..d33c2bdb1af 100644 --- a/public/message/templates/notification_preferences_component_notification.mustache +++ b/public/message/templates/notification_preferences_component_notification.mustache @@ -48,7 +48,7 @@ } }} - + {{#processors}}
{{{displayname}}} + {{#str}}preference, message{{/str}} +
{{{displayname}}}{{{displayname}}} {{#supportsprocessor}} @@ -66,8 +66,8 @@ {{#disableall}} disabled="true" {{/disableall}} {{#enabled}}checked{{/enabled}} > - + {{#hassettings}} Notification settings" in site administration @@ -109,6 +110,7 @@ Feature: Manage notification preferences - Email And I click on "Notification preferences" "link" in the "#page-content" "css_element" And I should see "Locked on" in the "[data-preference-key=message_provider_mod_forum_posts]" "css_element" And I should see "Locked off" in the "[data-preference-key=message_provider_mod_forum_digests]" "css_element" + And the page should meet accessibility standards with "best-practice" extra tests Scenario: User can disable notification preferences Given the following "courses" exist: From ac52b10f9fc284e7b8a98653bb7a0b1623488ebd Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Fri, 7 Nov 2025 20:28:39 +0800 Subject: [PATCH 2/2] MDL-86998 message: Fix accessibility issues in notification settings * Fix missing labels for the checkboxes that enable notification plugins * Add an accessible name for the Default notification preferences table * Fix missing table header for the preference column of the Default notification preferences table. * Accessibility Behat test coverage for the Notification settings admin page * Remove the unnecessary title attributes for the visually hidden labels --- public/lang/en/message.php | 1 + public/message/renderer.php | 13 +++++++++++-- .../default_notification_preferences.mustache | 17 ++++++++--------- .../tests/behat/message_preferences.feature | 3 ++- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/public/lang/en/message.php b/public/lang/en/message.php index 15cc6742b37..121eda2d973 100644 --- a/public/lang/en/message.php +++ b/public/lang/en/message.php @@ -69,6 +69,7 @@ $string['disallowed'] = 'Locked off'; $string['editmessages'] = 'Edit messages'; $string['emailtagline'] = 'This is a copy of a message sent to you on the site {$a->sitename}. Go to {$a->url} to reply.'; $string['enabled'] = 'Enabled'; +$string['enablenotificationplugin'] = 'Enable notification plugin: {$a}'; $string['errorcallingprocessor'] = 'Error calling defined output'; $string['errorconversationdoesnotexist'] = 'Conversation does not exist'; $string['errormessagetoolong'] = 'The message is longer than the maximum allowed.'; diff --git a/public/message/renderer.php b/public/message/renderer.php index d6e6f646620..94b881a0555 100644 --- a/public/message/renderer.php +++ b/public/message/renderer.php @@ -75,6 +75,8 @@ class core_message_renderer extends plugin_renderer_base { public function manage_messageoutputs($processors) { // Display the current workflows $table = new html_table(); + $table->caption = get_string('messageoutputs', 'message'); + $table->captionhide = true; $table->attributes['class'] = 'admintable table generaltable table-hover'; $table->data = array(); $table->head = array( @@ -90,7 +92,11 @@ class core_message_renderer extends plugin_renderer_base { $row = new html_table_row(); $row->attributes['class'] = 'messageoutputs'; - $name = new html_table_cell(get_string('pluginname', 'message_'.$processor->name)); + $pluginname = get_string('pluginname', 'message_' . $processor->name); + $name = new html_table_cell($pluginname); + $name->header = true; + $name->attributes['class'] = 'fw-normal'; + $name->attributes['scope'] = 'row'; $enable = new html_table_cell(); if (!$processor->available) { $enable->text = html_writer::nonempty_tag('span', get_string('outputnotavailable', 'message'), @@ -98,7 +104,10 @@ class core_message_renderer extends plugin_renderer_base { ); } else { $enable->text = html_writer::checkbox($processor->name, $processor->id, $processor->enabled, '', - array('id' => $processor->name) + [ + 'id' => $processor->name, + 'aria-label' => get_string('enablenotificationplugin', 'message', $pluginname), + ] ); } // Settings diff --git a/public/message/templates/default_notification_preferences.mustache b/public/message/templates/default_notification_preferences.mustache index 3d2c47ede0c..417a9dc2fcd 100644 --- a/public/message/templates/default_notification_preferences.mustache +++ b/public/message/templates/default_notification_preferences.mustache @@ -70,13 +70,15 @@ } }}
-

{{#str}} managemessageoutputs, message {{/str}}

+

{{#str}} managemessageoutputs, message {{/str}}

- +
- + {{#processors}} @@ -98,8 +100,7 @@ class="form-check-input provider_enabled" {{#enabled}}checked{{/enabled}} > -
+ {{#str}}preference, message{{/str}} + {{#str}} enabled, core_message {{/str}}{{{displayname}}}