MDL-33025 Ensure that hitting cancel clears the resource title editor
authorAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Wed, 16 May 2012 09:56:45 +0000 (10:56 +0100)
committerAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Wed, 16 May 2012 09:56:45 +0000 (10:56 +0100)
course/yui/toolboxes/toolboxes.js

index 7aa231e..dcb0f95 100644 (file)
@@ -572,6 +572,12 @@ YUI.add('moodle-course-toolboxes', function(Y) {
             // Cancel the edit if we lose focus or the escape key is pressed
             thisevent = editor.on('blur', cancel_edittitle);
             listenevents.push(thisevent);
+            thisevent = Y.one('document').on('keyup', function(e) {
+                if (e.keyCode == 27) {
+                    cancel_edittitle(e);
+                }
+            });
+            listenevents.push(thisevent);
 
             // Handle form submission
             thisevent = editform.on('submit', function(e) {