Merge branch 'MDL-63628-master' of git://github.com/damyon/moodle
authorSara Arjona <sara@moodle.com>
Tue, 22 Jan 2019 11:19:41 +0000 (12:19 +0100)
committerSara Arjona <sara@moodle.com>
Tue, 22 Jan 2019 11:19:41 +0000 (12:19 +0100)
blocks/private_files/module.js
mod/assign/module.js
mod/folder/module.js
mod/wiki/module.js

index 42a4026..203eb03 100644 (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();
         }
index c37dedf..f0ee769 100644 (file)
@@ -3,7 +3,7 @@ M.mod_assign = {};
 M.mod_assign.init_tree = function(Y, expand_all, htmlid) {
     var treeElement = Y.one('#'+htmlid);
     if (treeElement) {
-        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) {
@@ -11,6 +11,12 @@ M.mod_assign.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();
             }
index 46010ac..32e4514 100644 (file)
@@ -25,7 +25,7 @@
 M.mod_folder = {};
 
 M.mod_folder.init_tree = function(Y, id, expand_all) {
-    Y.use('yui2-treeview', function(Y) {
+    Y.use('yui2-treeview', 'node-event-simulate', function(Y) {
         var tree = new Y.YUI2.widget.TreeView(id);
 
         tree.subscribe("clickEvent", function(node, event) {
@@ -33,6 +33,12 @@ M.mod_folder.init_tree = function(Y, id, expand_all) {
             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();
         } else {
index cf59ef8..1b45bbf 100644 (file)
@@ -118,7 +118,7 @@ M.mod_wiki.deleteversion = function(Y, args) {
 }
 
 M.mod_wiki.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) {
@@ -126,6 +126,12 @@ M.mod_wiki.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();
         }