MDL-63628 accessibility: Trigger file links with keyboard

This commit is contained in:
Damyon Wiese 2018-10-12 11:41:49 +08:00
parent 4c5b60a0f9
commit 2fbd00cb22
4 changed files with 28 additions and 4 deletions

View file

@ -24,7 +24,7 @@
M.block_private_files = {};
M.block_private_files.init_tree = function(Y, expand_all, htmlid) {
Y.use('yui2-treeview', function(Y) {
Y.use('yui2-treeview', 'node-event-simulate', function(Y) {
var tree = new Y.YUI2.widget.TreeView(htmlid);
tree.subscribe("clickEvent", function(node, event) {
@ -32,6 +32,12 @@ M.block_private_files.init_tree = function(Y, expand_all, htmlid) {
return false;
});
tree.subscribe("enterKeyPressed", function(node) {
// We want keyboard activation to trigger a click on the first link.
Y.one(node.getContentEl()).one('a').simulate('click');
return false;
});
if (expand_all) {
tree.expandAll();
}