MDL-44079 Javascript: Check whether a dialogue is focused before closing

This commit is contained in:
Andrew Nicols
2014-02-11 12:30:07 +08:00
parent 4c56e8210c
commit afe32a1fe5
4 changed files with 35 additions and 2 deletions
@@ -95,6 +95,17 @@ Y.extend(DIALOGUE, Y.Panel, {
}
}
},
hide: function(e) {
if (e) {
// If the event was closed by an escape key event, then we need to check that this
// dialogue is currently focused to prevent closing all dialogues in the stack.
if (e.type === 'key' && e.keyCode === 27 && !this.get('focused')) {
return;
}
}
return DIALOGUE.superclass.hide.call(this, arguments);
},
centerDialogue : function() {
var bb = this.get('boundingBox'),
hidden = bb.hasClass(DIALOGUE_PREFIX+'-hidden'),
File diff suppressed because one or more lines are too long
@@ -95,6 +95,17 @@ Y.extend(DIALOGUE, Y.Panel, {
}
}
},
hide: function(e) {
if (e) {
// If the event was closed by an escape key event, then we need to check that this
// dialogue is currently focused to prevent closing all dialogues in the stack.
if (e.type === 'key' && e.keyCode === 27 && !this.get('focused')) {
return;
}
}
return DIALOGUE.superclass.hide.call(this, arguments);
},
centerDialogue : function() {
var bb = this.get('boundingBox'),
hidden = bb.hasClass(DIALOGUE_PREFIX+'-hidden'),
+11
View File
@@ -93,6 +93,17 @@ Y.extend(DIALOGUE, Y.Panel, {
}
}
},
hide: function(e) {
if (e) {
// If the event was closed by an escape key event, then we need to check that this
// dialogue is currently focused to prevent closing all dialogues in the stack.
if (e.type === 'key' && e.keyCode === 27 && !this.get('focused')) {
return;
}
}
return DIALOGUE.superclass.hide.call(this, arguments);
},
centerDialogue : function() {
var bb = this.get('boundingBox'),
hidden = bb.hasClass(DIALOGUE_PREFIX+'-hidden'),