MDL-86855 qbank_columnsortorder: Fix accessibility issues

* Fix empty column heading in admin settings page
* Add accessible labels for the move buttons
* Fix drag and drop Behat test
* Add accessibility Behat coverage
This commit is contained in:
Jun Pataleta
2025-10-24 12:02:54 +08:00
parent 7927f8d058
commit 83ffdd7a71
4 changed files with 18 additions and 6 deletions
@@ -71,6 +71,7 @@ class column_sort_ui implements renderable, templatable {
]);
$params['names'][] = [
'name' => $name,
'movetitle' => get_string('movecontent', 'core', $name),
'colname' => $colname,
'class' => $column->class,
'width' => $columnsizes[$column->id] ?? null,
@@ -36,6 +36,7 @@
* minwidth - The minimum value for the width field.
* width - The current value for the width field.
* actionmenu - The context for core/action_menu, a list of actions for the column.
* movetitle - The move handle button's accessible name. This is used by the core/drag_handle template.
* columnsdisabled - Are the any columns defined by disabled plugins?
* disabled - A list of disabled column names.
* disabledname - The disabled column's name.
@@ -73,7 +74,8 @@
"escapedid": "qbank_example__col_name_A-col_name_A",
"widthlabel": "Width of Column A",
"minwidth": "10",
"width": ""
"width": "",
"movetitle": "Move Column A"
},
{
"name": "Column B",
@@ -81,7 +83,8 @@
"columnid": "qbank_example\\col_name_B-col_name_B",
"escapedid": "qbank_example__col_name_B-col_name_B",
"minwidth": "10",
"width": "200"
"width": "200",
"movetitle": "Move Column B"
}
],
"columnsdisabled": true,
@@ -122,7 +125,9 @@
<table class="generaltable table table-fixed">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">
<span class="visually-hidden">{{#str}}move{{/str}}</span>
</th>
<th scope="col">{{#str}}name{{/str}}</th>
<th scope="col">{{#str}}plugin{{/str}}</th>
<th scope="col" class="w-25">{{#str}}columnwidth, qbank_columnsortorder{{/str}}</th>
@@ -8,7 +8,7 @@ Feature: Set default question bank column order and size
Given I change the window size to "large"
And I log in as "admin"
When I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
And I drag "Created by" "qbank_columnsortorder > column move handle" and I drop it in "T" "qbank_columnsortorder > column move handle"
And I drag "Move Created by" "button" and I drop it in "Move T" "button"
Then "Created by" "table_row" should appear before "T" "table_row"
And I reload the page
And "Created by" "table_row" should appear before "T" "table_row"
@@ -79,7 +79,7 @@ Feature: Set default question bank column order and size
And I should see "checkboxcustomcolumn"
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
And "checkboxcustomcolumn" "table_row" should appear after "Comments" "table_row"
When I drag "checkboxcustomcolumn" "qbank_columnsortorder > column move handle" and I drop it in "Comments" "qbank_columnsortorder > column move handle"
When I drag "Move checkboxcustomcolumn" "button" and I drop it in "Move Comments" "button"
And I set the field "Width of 'checkboxcustomcolumn' in pixels" to "200"
And I follow "Preview"
And "checkboxcustomcolumn" "qbank_columnsortorder > column header" should appear before "Comments" "qbank_columnsortorder > column header"
@@ -146,3 +146,9 @@ Feature: Set default question bank column order and size
And I should not see "Category for test" in the "#customfield_catlist" "css_element"
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
And I should see "Column sort order"
@accessibility
Scenario: The plugin administration page meets accessibility standards
Given I log in as "admin"
When I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
Then the "region-main" "region" should meet accessibility standards with "best-practice" extra tests
@@ -123,7 +123,7 @@ Feature: Set question bank column order and size
And I apply question bank filter "Category" with value "Question category 1"
And "Comments" "qbank_columnsortorder > column header" should appear before "Question" "qbank_columnsortorder > column header"
When I hover "Comments" "qbank_columnsortorder > column header"
And I drag "Comments" "qbank_columnsortorder > column move handle" and I drop it in "Status" "qbank_columnsortorder > column header"
And I drag "Move column 'Comments'" "button" and I drop it in "Status" "qbank_columnsortorder > column header"
Then "Comments" "qbank_columnsortorder > column header" should appear after "Question" "qbank_columnsortorder > column header"
And I reload the page
And "Comments" "qbank_columnsortorder > column header" should appear after "Question" "qbank_columnsortorder > column header"