Commit d772d11a authored by David Monllaó's avatar David Monllaó
Browse files

Merge branch 'MDL-50971-m28' of git://github.com/NeillM/moodle into MOODLE_28_STABLE

parents 41f04955 70fb7ac4
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -294,7 +294,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { ...@@ -294,7 +294,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
}; };
this.send_request(data); this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) { if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(); M.core.actionmenu.instance.hideMenu(ev);
} }
}, this); }, this);
...@@ -541,7 +541,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { ...@@ -541,7 +541,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
this.send_request(data, null, function(response) { this.send_request(data, null, function(response) {
if (M.core.actionmenu && M.core.actionmenu.instance) { if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(); M.core.actionmenu.instance.hideMenu(ev);
} }
// Try to retrieve the existing string from the server // Try to retrieve the existing string from the server
......
This files describes API changes in core libraries and APIs, This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers. information provided here is intended especially for developers.
=== 2.8.8 ===
* The actionmenu hideMenu() function now expects an EventFacade object to be passed to it,
i.e. a call to M.core.actionmenu.instance.hideMenu() can be changed to M.core.actionmenu.instance.hideMenu(e) to ensure good
behaviour when using custom action menus.
=== 2.8.7 === === 2.8.7 ===
* New methods grade_grade::get_grade_max() and get_grade_min() must be used rather than directly the public properties rawgrademax and rawgrademin. * New methods grade_grade::get_grade_max() and get_grade_min() must be used rather than directly the public properties rawgrademax and rawgrademin.
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -244,9 +244,10 @@ ACTIONMENU.prototype = { ...@@ -244,9 +244,10 @@ ACTIONMENU.prototype = {
/** /**
* Hides the menu if it is visible. * Hides the menu if it is visible.
* @param {EventFacade} e
* @method hideMenu * @method hideMenu
*/ */
hideMenu : function() { hideMenu : function(e) {
if (this.dialogue) { if (this.dialogue) {
Y.log('Hiding an action menu', 'debug', ACTIONMENU.NAME); Y.log('Hiding an action menu', 'debug', ACTIONMENU.NAME);
this.dialogue.removeClass('show'); this.dialogue.removeClass('show');
...@@ -265,7 +266,10 @@ ACTIONMENU.prototype = { ...@@ -265,7 +266,10 @@ ACTIONMENU.prototype = {
} }
if (this.menulink) { if (this.menulink) {
this.menulink.focus(); if (!e || e.type != 'click') {
// We needed to test !e to retain backwards compatiablity if the event is not passed.
this.menulink.focus();
}
this.menulink = null; this.menulink = null;
} }
}, },
...@@ -292,7 +296,7 @@ ACTIONMENU.prototype = { ...@@ -292,7 +296,7 @@ ACTIONMENU.prototype = {
// Prevent event propagation as it will trigger the hideIfOutside event handler in certain situations. // Prevent event propagation as it will trigger the hideIfOutside event handler in certain situations.
e.halt(true); e.halt(true);
this.hideMenu(); this.hideMenu(e);
if (menuvisible) { if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again. // The menu was visible and the user has clicked to toggle it again.
return; return;
...@@ -321,7 +325,7 @@ ACTIONMENU.prototype = { ...@@ -321,7 +325,7 @@ ACTIONMENU.prototype = {
this.lastMenuChild.focus(); this.lastMenuChild.focus();
e.preventDefault(); e.preventDefault();
} else if (e.keyCode === 9 && e.shiftKey) { } else if (e.keyCode === 9 && e.shiftKey) {
this.hideMenu(); this.hideMenu(e);
e.preventDefault(); e.preventDefault();
} }
return this; return this;
...@@ -329,7 +333,7 @@ ACTIONMENU.prototype = { ...@@ -329,7 +333,7 @@ ACTIONMENU.prototype = {
if (e.keyCode === 27) { if (e.keyCode === 27) {
// The escape key was pressed so close the menu. // The escape key was pressed so close the menu.
this.hideMenu(); this.hideMenu(e);
e.preventDefault(); e.preventDefault();
} else if (e.keyCode === 32) { } else if (e.keyCode === 32) {
...@@ -340,10 +344,10 @@ ACTIONMENU.prototype = { ...@@ -340,10 +344,10 @@ ACTIONMENU.prototype = {
// The tab key was pressed. Tab moves forwards, Shift + Tab moves backwards through the menu options. // The tab key was pressed. Tab moves forwards, Shift + Tab moves backwards through the menu options.
// We only override the Shift + Tab on the first option, and Tab on the last option to change where the focus is moved to. // We only override the Shift + Tab on the first option, and Tab on the last option to change where the focus is moved to.
if (e.target === this.firstMenuChild && e.shiftKey) { if (e.target === this.firstMenuChild && e.shiftKey) {
this.hideMenu(); this.hideMenu(e);
e.preventDefault(); e.preventDefault();
} else if (e.target === this.lastMenuChild && !e.shiftKey) { } else if (e.target === this.lastMenuChild && !e.shiftKey) {
if (this.hideMenu()) { if (this.hideMenu(e)) {
// Determine the next selector and focus on it. // Determine the next selector and focus on it.
next = this.menulink.next(SELECTOR.CAN_RECEIVE_FOCUS_SELECTOR); next = this.menulink.next(SELECTOR.CAN_RECEIVE_FOCUS_SELECTOR);
if (next) { if (next) {
...@@ -410,7 +414,7 @@ ACTIONMENU.prototype = { ...@@ -410,7 +414,7 @@ ACTIONMENU.prototype = {
*/ */
hideIfOutside : function(e) { hideIfOutside : function(e) {
if (!e.target.ancestor(SELECTOR.MENUCHILD, true)) { if (!e.target.ancestor(SELECTOR.MENUCHILD, true)) {
this.hideMenu(); this.hideMenu(e);
} }
}, },
...@@ -462,7 +466,7 @@ ACTIONMENU.prototype = { ...@@ -462,7 +466,7 @@ ACTIONMENU.prototype = {
if (e.currentTarget.test(SELECTOR.KEEPOPEN)) { if (e.currentTarget.test(SELECTOR.KEEPOPEN)) {
return; return;
} }
this.hideMenu(); this.hideMenu(e);
}, SELECTOR.MENUCHILD, this)); }, SELECTOR.MENUCHILD, this));
return true; return true;
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -172,7 +172,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { ...@@ -172,7 +172,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
Y.Moodle.mod_quiz.util.slot.remove(element); Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page(); this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) { if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(); M.core.actionmenu.instance.hideMenu(ev);
} }
} else { } else {
window.location.reload(true); window.location.reload(true);
...@@ -217,7 +217,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { ...@@ -217,7 +217,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
this.send_request(data, null, function(response) { this.send_request(data, null, function(response) {
if (M.core.actionmenu && M.core.actionmenu.instance) { if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(); M.core.actionmenu.instance.hideMenu(ev);
} }
// Try to retrieve the existing string from the server. // Try to retrieve the existing string from the server.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment