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.
This commit is contained in:
Jun Pataleta
2025-11-03 11:58:14 +08:00
parent c410621d82
commit b164980bcd
5 changed files with 10 additions and 7 deletions
+3 -3
View File
@@ -89,7 +89,7 @@
{{/canmovecategories}}
{{{nameeditable}}}
{{#canedit}}
<button type="button" class="btn btn-link btn-icon icon-size-3" data-role="deletecategory" data-id="{{id}}" title="{{#str}} delete {{/str}}" aria-label="{{#str}} delete {{/str}}">
<button type="button" class="btn btn-link btn-icon icon-size-3" data-role="deletecategory" data-id="{{id}}" title="{{#str}} deletecategory, customfield, {{name}} {{/str}}" aria-label="{{#str}} deletecategory, customfield, {{name}} {{/str}}">
{{#pix}} t/delete, core {{/pix}}
</button>
{{/canedit}}
@@ -128,10 +128,10 @@
<td class="col-2">{{{type}}}</td>
<td class="col-2 text-end">
{{#canedit}}
<button type="button" class="btn btn-link btn-icon icon-no-margin" data-role="editfield" data-name="{{name}}" data-id="{{id}}" title="{{#str}} edit {{/str}}" aria-label="{{#str}} edit {{/str}}">
<button type="button" class="btn btn-link btn-icon" data-role="editfield" data-name="{{name}}" data-id="{{id}}" title="{{#str}} editfield, customfield, {{name}} {{/str}}" aria-label="{{#str}} editfield, customfield, {{name}} {{/str}}">
{{#pix}} t/edit, core {{/pix}}
</button>
<button type="button" class="btn btn-link btn-icon icon-no-margin" data-id="{{id}}" data-role="deletefield" title=" {{#str}} delete {{/str}}" aria-label="{{#str}} delete {{/str}}">
<button type="button" class="btn btn-link btn-icon" data-id="{{id}}" data-role="deletefield" title="{{#str}} deletefield, customfield, {{name}} {{/str}}" aria-label="{{#str}} deletefield, customfield, {{name}} {{/str}}">
{{#pix}} t/delete, core {{/pix}}
</button>
{{/canedit}}
@@ -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
@@ -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"
@@ -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
+3
View File
@@ -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.';