Skip to content

Commit

Permalink
MDL-75837 gradebook: accessibility improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning authored and Mihail Geshoski committed Nov 14, 2022
1 parent f589d59 commit 57e6548
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 226 deletions.
4 changes: 2 additions & 2 deletions grade/amd/build/searchwidget/basewidget.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion grade/amd/build/searchwidget/basewidget.min.js.map

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions grade/amd/src/searchwidget/basewidget.js
Expand Up @@ -22,7 +22,6 @@
*/
import {debounce} from 'core/utils';
import * as Templates from 'core/templates';
import {comboBox} from 'core/aria';
import * as Selectors from 'core_grades/searchwidget/selectors';
import Notification from 'core/notification';

Expand Down Expand Up @@ -69,6 +68,8 @@ export const init = async(widgetContentContainer, bodyPromise, data, searchFunc,
export const registerListenerEvents = (widgetContentContainer, data, searchFunc) => {
const searchResultsContainer = widgetContentContainer.querySelector(Selectors.regions.searchResults);
const searchInput = widgetContentContainer.querySelector(Selectors.actions.search);
// We want to focus on the first known user interable element within the dropdown.
searchInput.focus();
const clearSearchButton = widgetContentContainer.querySelector(Selectors.actions.clearSearch);

// The search input is triggered.
Expand Down Expand Up @@ -108,9 +109,6 @@ export const registerListenerEvents = (widgetContentContainer, data, searchFunc)
)
);
});

// Trigger event handling for the results in line with aria guidelines.
comboBox(searchInput);
};

/**
Expand Down
Expand Up @@ -105,6 +105,7 @@ public static function execute(int $courseid, string $actionbaseurl, ?int $group
$userpicture->size = 1;
$user->profileimage = $userpicture->get_url($PAGE)->out(false);
$user->email = $guiuser->email;
$user->active = false; // @TODO MDL-76246

$users[] = $user;
}
Expand Down Expand Up @@ -151,6 +152,7 @@ public static function user_description(): \external_description {
core_user::get_property_type('email'),
'An email address - allow email as root@localhost',
VALUE_OPTIONAL),
'active' => new external_value(PARAM_BOOL, 'Are we currently on this item?', VALUE_REQUIRED)
];
return new external_single_structure($userfields);
}
Expand Down
4 changes: 4 additions & 0 deletions grade/classes/external/get_groups_for_search_widget.php
Expand Up @@ -116,8 +116,10 @@ protected static function execute(int $courseid, string $actionbaseurl): array {
'group' => $group->id
]);
return (object) [
'id' => $group->id,
'name' => $group->name,
'url' => $url->out(false),
'active' => false // @TODO MDL-76246
];
}, $groupsmenu);
}
Expand Down Expand Up @@ -147,8 +149,10 @@ public static function execute_returns(): external_single_structure {
*/
public static function group_description(): external_description {
$groupfields = [
'id' => new external_value(PARAM_ALPHANUM, 'An ID for the group', VALUE_REQUIRED),
'url' => new external_value(PARAM_URL, 'The link that applies the group action', VALUE_REQUIRED),
'name' => new external_value(PARAM_TEXT, 'The full name of the group', VALUE_REQUIRED),
'active' => new external_value(PARAM_BOOL, 'Are we currently on this item?', VALUE_REQUIRED)
];
return new external_single_structure($groupfields);
}
Expand Down
6 changes: 4 additions & 2 deletions grade/report/singleview/classes/external/singleview.php
Expand Up @@ -85,7 +85,7 @@ protected static function get_grade_items_for_search_widget(int $courseid): arra

$gradeitems = array_map(function ($gradeitem) use ($PAGE, $USER, $params) {
$item = new \stdClass();
$item->gid = $gradeitem->id;
$item->id = $gradeitem->id;
$url = new moodle_url('/grade/report/singleview/index.php', [
'id' => $params['courseid'],
'itemid' => $gradeitem->id,
Expand All @@ -94,6 +94,7 @@ protected static function get_grade_items_for_search_widget(int $courseid): arra
);
$item->name = $gradeitem->get_name(true);
$item->url = $url->out(false);
$item->active = false; // @TODO MDL-76246

return $item;
}, $gradeableitems);
Expand All @@ -114,13 +115,14 @@ public static function get_grade_items_for_search_widget_returns(): external_sin
return new external_single_structure([
'gradeitems' => new external_multiple_structure(
new external_single_structure([
'gid' => new external_value(PARAM_INT, 'ID of the grade item', VALUE_OPTIONAL),
'id' => new external_value(PARAM_INT, 'ID of the grade item', VALUE_OPTIONAL),
'url' => new external_value(
PARAM_URL,
'The link to the grade report',
VALUE_OPTIONAL
),
'name' => new external_value(PARAM_TEXT, 'The full name of the grade item', VALUE_OPTIONAL),
'active' => new external_value(PARAM_BOOL, 'Are we currently on this item?', VALUE_REQUIRED)
])
),
'warnings' => new external_warnings(),
Expand Down
2 changes: 1 addition & 1 deletion grade/report/singleview/templates/zero_state.mustache
Expand Up @@ -27,7 +27,7 @@
}
}}
<div class="zero-state mx-auto w-50 text-center my-6">
<img src="{{imglink}}" alt="{{#str}}pluginname, gradereport_singleview{{/str}}" role="presentation" class="my-5">
<img src="{{imglink}}" alt="{{#str}}pluginname, gradereport_singleview{{/str}}" aria-hidden="true" class="my-5">
<h3>{{#str}}pluginname, gradereport_singleview{{/str}}</h3>
<p>{{#str}}viewsingleuserorgradeitem, gradereport_singleview{{/str}}</p>
<div class="justify-content-center d-flex">
Expand Down
Expand Up @@ -25,7 +25,7 @@
}
}}
<div class="zero-state mx-auto w-50 text-center my-6">
<img src="{{imglink}}" alt="{{#str}}viewsinglegradeitem, gradereport_singleview{{/str}}" role="presentation" class="my-5">
<img src="{{imglink}}" alt="{{#str}}viewsinglegradeitem, gradereport_singleview{{/str}}" aria-hidden="true" class="my-5">
<h3>{{#str}}viewsinglegradeitem, gradereport_singleview{{/str}}</h3>
<p>{{#str}}singleviewdescription, gradereport_singleview{{/str}}</p>
</div>
2 changes: 1 addition & 1 deletion grade/report/singleview/templates/zero_state_user.mustache
Expand Up @@ -25,7 +25,7 @@
}
}}
<div class="zero-state mx-auto w-50 text-center my-6">
<img src="{{imglink}}" alt="{{#str}}viewsingleuser, gradereport_singleview{{/str}}" role="presentation" class="my-5">
<img src="{{imglink}}" alt="{{#str}}viewsingleuser, gradereport_singleview{{/str}}" aria-hidden="true" class="my-5">
<h3>{{#str}}viewsingleuser, gradereport_singleview{{/str}}</h3>
<p>{{#str}}singleviewdescription, gradereport_singleview{{/str}}</p>
</div>
2 changes: 1 addition & 1 deletion grade/report/user/amd/build/user.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 57e6548

Please sign in to comment.