diff --git a/admin/tool/admin_presets/tests/behat/apply_presets.feature b/admin/tool/admin_presets/tests/behat/apply_presets.feature index d097c0998c2..163ed05157a 100644 --- a/admin/tool/admin_presets/tests/behat/apply_presets.feature +++ b/admin/tool/admin_presets/tests/behat/apply_presets.feature @@ -20,9 +20,9 @@ Feature: I can apply presets And I navigate to "Plugins > Course formats > Manage course formats" in site administration And "Disable" "icon" should exist in the "Social" "table_row" And I navigate to "Plugins > Question behaviours > Manage question behaviours" in site administration - And "Enabled" "icon" should exist in the "Immediate feedback with CBM" "table_row" + And "Enabled" "link" should exist in the "Immediate feedback with CBM" "table_row" And I navigate to "Plugins > Question types > Manage question types" in site administration - And "Enabled" "icon" should exist in the "Calculated multichoice" "table_row" + And "Enabled" "link" should exist in the "Calculated multichoice" "table_row" When I navigate to "Site admin presets" in site administration And I press "Review settings and apply" action in the "Starter" report row And I should see "Setting changes" @@ -111,9 +111,9 @@ Feature: I can apply presets And I navigate to "Plugins > Course formats > Manage course formats" in site administration And "Disable" "icon" should not exist in the "Social" "table_row" And I navigate to "Plugins > Question behaviours > Manage question behaviours" in site administration - And "Enabled" "icon" should not exist in the "Immediate feedback with CBM" "table_row" + And "Enabled" "link" should not exist in the "Immediate feedback with CBM" "table_row" And I navigate to "Plugins > Question types > Manage question types" in site administration - And "Enabled" "icon" should not exist in the "Calculated multichoice" "table_row" + And "Enabled" "link" should not exist in the "Calculated multichoice" "table_row" Scenario: Re-applying Starter Moodle preset does not display setting changes # Apply Starter preset. diff --git a/admin/tool/admin_presets/tests/behat/revert_changes.feature b/admin/tool/admin_presets/tests/behat/revert_changes.feature index a3da9a4c301..0ba6c161049 100644 --- a/admin/tool/admin_presets/tests/behat/revert_changes.feature +++ b/admin/tool/admin_presets/tests/behat/revert_changes.feature @@ -27,9 +27,9 @@ Feature: I can revert changes after a load And I navigate to "Plugins > Course formats > Manage course formats" in site administration And "Disable" "icon" should not exist in the "Social" "table_row" And I navigate to "Plugins > Question behaviours > Manage question behaviours" in site administration - And "Enabled" "icon" should not exist in the "Immediate feedback with CBM" "table_row" + And "Enabled" "link" should not exist in the "Immediate feedback with CBM" "table_row" And I navigate to "Plugins > Question types > Manage question types" in site administration - And "Enabled" "icon" should not exist in the "Calculated multichoice" "table_row" + And "Enabled" "link" should not exist in the "Calculated multichoice" "table_row" And I navigate to "Site admin presets" in site administration And I press "Show version history" action in the "Starter" report row When I click on "Restore this version" "link" @@ -45,6 +45,6 @@ Feature: I can revert changes after a load And I navigate to "Plugins > Course formats > Manage course formats" in site administration And "Disable" "icon" should exist in the "Social" "table_row" And I navigate to "Plugins > Question behaviours > Manage question behaviours" in site administration - And "Enabled" "icon" should exist in the "Immediate feedback with CBM" "table_row" + And "Enabled" "link" should exist in the "Immediate feedback with CBM" "table_row" And I navigate to "Plugins > Question types > Manage question types" in site administration - And "Enabled" "icon" should exist in the "Calculated multichoice" "table_row" + And "Enabled" "link" should exist in the "Calculated multichoice" "table_row" diff --git a/admin/tool/uploadcourse/tests/behat/enrolments.feature b/admin/tool/uploadcourse/tests/behat/enrolments.feature index 03dc9931832..0ff68cc5a6f 100644 --- a/admin/tool/uploadcourse/tests/behat/enrolments.feature +++ b/admin/tool/uploadcourse/tests/behat/enrolments.feature @@ -25,7 +25,7 @@ Feature: An admin can update courses enrolments using a CSV file When I click on "Upload courses" "button" Then I should see "Course updated" And I am on the "Course 1" "enrolment methods" page - And "Disable" "icon" should exist in the "Guest access" "table_row" + And "Disable" "link" should exist in the "Guest access" "table_row" @javascript Scenario: Creating enrolment method by disabling it @@ -42,7 +42,7 @@ Feature: An admin can update courses enrolments using a CSV file When I click on "Upload courses" "button" Then I should see "Course updated" And I am on the "Course 1" "enrolment methods" page - And "Enable" "icon" should exist in the "Guest access" "table_row" + And "Enable" "link" should exist in the "Guest access" "table_row" @javascript Scenario: Enabling enrolment method @@ -55,13 +55,13 @@ Feature: An admin can update courses enrolments using a CSV file When I click on "Upload courses" "button" Then I should see "Course updated" And I am on the "Course 1" "enrolment methods" page - And "Disable" "icon" should exist in the "Guest access" "table_row" + And "Disable" "link" should exist in the "Guest access" "table_row" @javascript Scenario: Disable an enrolment method Given I am on the "Course 1" "enrolment methods" page And I click on "Enable" "link" in the "Guest access" "table_row" - And "Disable" "icon" should exist in the "Guest access" "table_row" + And "Disable" "link" should exist in the "Guest access" "table_row" And I navigate to "Courses > Upload courses" in site administration And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_disable.csv" file to "File" filemanager And I set the field "Upload mode" to "Only update existing courses" @@ -71,7 +71,7 @@ Feature: An admin can update courses enrolments using a CSV file When I click on "Upload courses" "button" Then I should see "Course updated" And I am on the "Course 1" "enrolment methods" page - And "Enable" "icon" should exist in the "Guest access" "table_row" + And "Enable" "link" should exist in the "Guest access" "table_row" @javascript Scenario: Delete an enrolment method diff --git a/lib/classes/output/core_renderer.php b/lib/classes/output/core_renderer.php index d4b87f91953..967afd7521b 100644 --- a/lib/classes/output/core_renderer.php +++ b/lib/classes/output/core_renderer.php @@ -1661,14 +1661,20 @@ class core_renderer extends renderer_base { $attributes['class'] = 'action-icon'; } - if ($linktext) { - $text = $pixicon->attributes['alt']; - // Set the icon as a decorative image if we're displaying the action text. - // Otherwise, the action name will be read twice by assistive technologies. - $pixicon->attributes['alt'] = ''; - $pixicon->attributes['title'] = ''; - $pixicon->attributes['aria-hidden'] = 'true'; - } else { + $text = $pixicon->attributes['alt']; + // Set the icon as a decorative image. The accessible label should be within the link itself and not the icon. + $pixicon->attributes['alt'] = ''; + $pixicon->attributes['title'] = ''; + $pixicon->attributes['aria-hidden'] = 'true'; + + $attributes['class'] .= ' mx-1 p-1'; + if (!$linktext) { + // Set a title attribute on the link for sighted users if no text is shown. + $attributes['title'] = $text; + // Style the icon button for increased target area. + $attributes['class'] .= ' btn btn-link icon-no-margin'; + // Make the action text only available to screen readers. + $attributes['aria-label'] = $text; $text = ''; } diff --git a/lib/tests/behat/permissionmanager.feature b/lib/tests/behat/permissionmanager.feature index d8dfecf2bfb..e329db3eeb1 100644 --- a/lib/tests/behat/permissionmanager.feature +++ b/lib/tests/behat/permissionmanager.feature @@ -17,7 +17,7 @@ Feature: Override permissions on a context Scenario: Default system capabilities modification Given I am on the "C1" "permissions" page logged in as "admin" - When I click on "Allow" "icon" in the "mod/forum:addnews" "table_row" + When I click on "Allow" "link" in the "mod/forum:addnews" "table_row" And I press "Student" Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should contain "Student" When I reload the page @@ -25,7 +25,7 @@ Feature: Override permissions on a context And I click on "Remove" "button" in the "Confirm role change" "dialogue" Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should not contain "Student" When I reload the page - And I click on "Prohibit" "icon" in the "mod/forum:addnews" "table_row" + And I click on "Prohibit" "link" in the "mod/forum:addnews" "table_row" And I press "Student" Then "Add announcementsmod/forum:addnews" row "Prohibited" column of "permissions" table should contain "Student" @@ -35,7 +35,7 @@ Feature: Override permissions on a context | activity | forum | | name | Forum 1 | And I am on the "Forum 1" "forum activity permissions" page logged in as admin - When I click on "Allow" "icon" in the "mod/forum:addnews" "table_row" + When I click on "Allow" "link" in the "mod/forum:addnews" "table_row" And I press "Student" Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should contain "Student" When I reload the page @@ -43,7 +43,7 @@ Feature: Override permissions on a context And I click on "Remove" "button" in the "Confirm role change" "dialogue" Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should not contain "Student" When I reload the page - And I click on "Prohibit" "icon" in the "mod/forum:addnews" "table_row" + And I click on "Prohibit" "link" in the "mod/forum:addnews" "table_row" And I press "Student" Then "Add announcementsmod/forum:addnews" row "Prohibited" column of "permissions" table should contain "Student"