From b164980bcda7585b6fcff96117aefc67ba9a8bb8 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Fri, 19 Sep 2025 15:31:32 +0800 Subject: [PATCH] MDL-86701 customfield: Better naming of custom field action buttons Include the category and field names for accessible names of the delete and action buttons to help assistive technology users better understand the buttons' purpose. --- public/customfield/templates/list.mustache | 6 +++--- public/customfield/tests/behat/edit_categories.feature | 2 +- public/customfield/tests/behat/edit_fields_settings.feature | 2 +- public/customfield/tests/behat/shared_custom_fields.feature | 4 ++-- public/lang/en/customfield.php | 3 +++ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/public/customfield/templates/list.mustache b/public/customfield/templates/list.mustache index 8b2b9fe6c54..1bc7895bc8a 100644 --- a/public/customfield/templates/list.mustache +++ b/public/customfield/templates/list.mustache @@ -89,7 +89,7 @@ {{/canmovecategories}} {{{nameeditable}}} {{#canedit}} - {{/canedit}} @@ -128,10 +128,10 @@ {{{type}}} {{#canedit}} - - {{/canedit}} diff --git a/public/customfield/tests/behat/edit_categories.feature b/public/customfield/tests/behat/edit_categories.feature index 1d3a11592e4..e8dbaf0d663 100644 --- a/public/customfield/tests/behat/edit_categories.feature +++ b/public/customfield/tests/behat/edit_categories.feature @@ -35,7 +35,7 @@ Feature: Managers can manage categories for course custom fields | Field 1 | Category for test | text | f1 | And I log in as "admin" And I navigate to "Courses > Default settings > Course custom fields" in site administration - And I click on "[data-role='deletecategory']" "css_element" + And I press "Delete custom field category: Category for test" And I click on "Yes" "button" in the "Confirm" "dialogue" And I wait until the page is ready And I wait until "Test category" "text" does not exist diff --git a/public/customfield/tests/behat/edit_fields_settings.feature b/public/customfield/tests/behat/edit_fields_settings.feature index 977ff899022..5c695dda66e 100644 --- a/public/customfield/tests/behat/edit_fields_settings.feature +++ b/public/customfield/tests/behat/edit_fields_settings.feature @@ -77,7 +77,7 @@ Feature: Teachers can edit course custom fields Scenario: Use images in the custom field description When I log in as "admin" And I navigate to "Courses > Default settings > Course custom fields" in site administration - And I click on "Edit" "link" in the "Field 1" "table_row" + And I press "Edit custom field: Field 1" And I click on "Image" "button" in the "Description" "form_row" And I click on "Browse repositories" "button" And I click on "Private files" "link" in the ".fp-repo-area" "css_element" diff --git a/public/customfield/tests/behat/shared_custom_fields.feature b/public/customfield/tests/behat/shared_custom_fields.feature index 18fa059ec26..fd505f49f7a 100644 --- a/public/customfield/tests/behat/shared_custom_fields.feature +++ b/public/customfield/tests/behat/shared_custom_fields.feature @@ -42,8 +42,8 @@ Feature: Create shared categories and fields And I log in as "admin" And I navigate to "Courses > Default settings > Course custom fields" in site administration # Check that the delete category link exists for course categories but not for shared categories. - Then "Delete" "link" should exist in the ".//div[contains(@class, 'categoryinstance')][.//span[@data-value='My course category']]" "xpath_element" - And "Delete" "link" should not exist in the ".//div[contains(@class,'categoryinstance')]/h3[normalize-space(text())='My shared category']" "xpath_element" + Then "Delete custom field category: My course category" "button" should exist + And "Delete custom field category: My shared category" "button" should not exist # Check that the inplaceeditable exists for course categories but not for shared categories. And "//div[contains(@class,'categoryinstance') and contains(.,'My course category') and .//span[contains(@class,'inplaceeditable')]]" "xpath_element" should exist And "//div[contains(@class,'categoryinstance') and contains(.,'My shared category') and .//span[contains(@class,'inplaceeditable')]]" "xpath_element" should not exist diff --git a/public/lang/en/customfield.php b/public/lang/en/customfield.php index 847c015873a..3a3f85be531 100644 --- a/public/lang/en/customfield.php +++ b/public/lang/en/customfield.php @@ -37,10 +37,13 @@ $string['customfield'] = 'Custom field'; $string['customfielddata'] = 'Custom fields data'; $string['customfields'] = 'Custom fields'; $string['defaultvalue'] = 'Default value'; +$string['deletecategory'] = 'Delete custom field category: {$a}'; +$string['deletefield'] = 'Delete custom field: {$a}'; $string['description'] = 'Description'; $string['description_help'] = 'The description is displayed in the form below the field.'; $string['edit'] = 'Edit'; $string['editcategoryname'] = 'Edit category name'; +$string['editfield'] = 'Edit custom field: {$a}'; $string['editingfield'] = 'Updating {$a}'; $string['errorfieldtypenotfound'] = 'Field type {$a} not found'; $string['erroruniquevalues'] = 'This value is already used.';