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

This commit is contained in:
Andrew Nicols
2014-02-11 12:25:00 +08:00
parent 27ebbdd703
commit 624feb24f2
4 changed files with 28 additions and 4 deletions
@@ -350,7 +350,15 @@ Y.extend(DIALOGUE, Y.Panel, {
return result;
},
hide: function() {
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;
}
}
// Unlock scroll if the plugin is present.
if (this.lockScroll) {
this.lockScroll.disableScrollLock();
File diff suppressed because one or more lines are too long
@@ -350,7 +350,15 @@ Y.extend(DIALOGUE, Y.Panel, {
return result;
},
hide: function() {
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;
}
}
// Unlock scroll if the plugin is present.
if (this.lockScroll) {
this.lockScroll.disableScrollLock();
+9 -1
View File
@@ -319,7 +319,15 @@ Y.extend(DIALOGUE, Y.Panel, {
return result;
},
hide: function() {
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;
}
}
// Unlock scroll if the plugin is present.
if (this.lockScroll) {
this.lockScroll.disableScrollLock();