MDL-42928 JavaScript: Add LockScroll to all modal dialogues
This commit is contained in:
+19
-1
@@ -118,6 +118,10 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
}
|
||||
this.set('COUNT', COUNT);
|
||||
|
||||
if (this.get('modal')) {
|
||||
this.plug(Y.M.core.LockScroll);
|
||||
}
|
||||
|
||||
// Workaround upstream YUI bug http://yuilibrary.com/projects/yui3/ticket/2532507
|
||||
// and allow setting of z-index in theme.
|
||||
bb = this.get('boundingBox');
|
||||
@@ -317,6 +321,11 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
header = this.headerNode,
|
||||
content = this.bodyNode;
|
||||
|
||||
// Lock scroll if the plugin is present.
|
||||
if (this.lockScroll) {
|
||||
this.lockScroll.enableScrollLock();
|
||||
}
|
||||
|
||||
result = DIALOGUE.superclass.show.call(this);
|
||||
if (header && header !== '') {
|
||||
header.focus();
|
||||
@@ -325,6 +334,15 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
// Unlock scroll if the plugin is present.
|
||||
if (this.lockScroll) {
|
||||
this.lockScroll.disableScrollLock();
|
||||
}
|
||||
|
||||
return DIALOGUE.superclass.hide.call(this, arguments);
|
||||
},
|
||||
/**
|
||||
* Setup key delegation to keep tabbing within the open dialogue.
|
||||
*
|
||||
@@ -550,4 +568,4 @@ Y.Base.modifyAttrs(DIALOGUE, {
|
||||
M.core.dialogue = DIALOGUE;
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "panel", "event-key", "dd-plugin"]});
|
||||
}, '@VERSION@', {"requires": ["base", "node", "panel", "event-key", "dd-plugin", "moodle-core-lockscroll"]});
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+19
-1
@@ -118,6 +118,10 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
}
|
||||
this.set('COUNT', COUNT);
|
||||
|
||||
if (this.get('modal')) {
|
||||
this.plug(Y.M.core.LockScroll);
|
||||
}
|
||||
|
||||
// Workaround upstream YUI bug http://yuilibrary.com/projects/yui3/ticket/2532507
|
||||
// and allow setting of z-index in theme.
|
||||
bb = this.get('boundingBox');
|
||||
@@ -317,6 +321,11 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
header = this.headerNode,
|
||||
content = this.bodyNode;
|
||||
|
||||
// Lock scroll if the plugin is present.
|
||||
if (this.lockScroll) {
|
||||
this.lockScroll.enableScrollLock();
|
||||
}
|
||||
|
||||
result = DIALOGUE.superclass.show.call(this);
|
||||
if (header && header !== '') {
|
||||
header.focus();
|
||||
@@ -325,6 +334,15 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
// Unlock scroll if the plugin is present.
|
||||
if (this.lockScroll) {
|
||||
this.lockScroll.disableScrollLock();
|
||||
}
|
||||
|
||||
return DIALOGUE.superclass.hide.call(this, arguments);
|
||||
},
|
||||
/**
|
||||
* Setup key delegation to keep tabbing within the open dialogue.
|
||||
*
|
||||
@@ -548,4 +566,4 @@ Y.Base.modifyAttrs(DIALOGUE, {
|
||||
M.core.dialogue = DIALOGUE;
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "panel", "event-key", "dd-plugin"]});
|
||||
}, '@VERSION@', {"requires": ["base", "node", "panel", "event-key", "dd-plugin", "moodle-core-lockscroll"]});
|
||||
|
||||
+18
@@ -87,6 +87,10 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
}
|
||||
this.set('COUNT', COUNT);
|
||||
|
||||
if (this.get('modal')) {
|
||||
this.plug(Y.M.core.LockScroll);
|
||||
}
|
||||
|
||||
// Workaround upstream YUI bug http://yuilibrary.com/projects/yui3/ticket/2532507
|
||||
// and allow setting of z-index in theme.
|
||||
bb = this.get('boundingBox');
|
||||
@@ -286,6 +290,11 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
header = this.headerNode,
|
||||
content = this.bodyNode;
|
||||
|
||||
// Lock scroll if the plugin is present.
|
||||
if (this.lockScroll) {
|
||||
this.lockScroll.enableScrollLock();
|
||||
}
|
||||
|
||||
result = DIALOGUE.superclass.show.call(this);
|
||||
if (header && header !== '') {
|
||||
header.focus();
|
||||
@@ -294,6 +303,15 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
// Unlock scroll if the plugin is present.
|
||||
if (this.lockScroll) {
|
||||
this.lockScroll.disableScrollLock();
|
||||
}
|
||||
|
||||
return DIALOGUE.superclass.hide.call(this, arguments);
|
||||
},
|
||||
/**
|
||||
* Setup key delegation to keep tabbing within the open dialogue.
|
||||
*
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
"node",
|
||||
"panel",
|
||||
"event-key",
|
||||
"dd-plugin"
|
||||
"dd-plugin",
|
||||
"moodle-core-lockscroll"
|
||||
]
|
||||
},
|
||||
"moodle-core-notification-alert": {
|
||||
|
||||
Reference in New Issue
Block a user