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

This commit is contained in:
Andrew Nicols 2014-02-11 11:26:46 +08:00
parent 974c2cdc03
commit bf24abd221
4 changed files with 28 additions and 4 deletions

View File

@ -340,7 +340,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

View File

@ -340,7 +340,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();

View File

@ -309,7 +309,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();