Skip to content
Permalink
Browse files

MDL-48643 Javascript: Create modals hidden, then show, to prevent scroll

Modal dialogs need to be created with visible: false and then call
.show() on it to make it visible. This prevents the page from jumping to
the top.
  • Loading branch information...
merrill-oakland committed Dec 17, 2014
1 parent 981f06f commit 6f0776b6ff7ec94e8104f160e3007095aaa29764
@@ -635,13 +635,14 @@ M.course_dndupload = {
bodyContent: content,
width: '350px',
modal: true,
visible: true,
visible: false,
render: true,
align: {
node: null,
points: [Y.WidgetPositionAlign.CC, Y.WidgetPositionAlign.CC]
}
});
panel.show();
// When the panel is hidden - destroy it and then check for other pending uploads
panel.after("visibleChange", function(e) {
if (!panel.get('visible')) {
@@ -481,8 +481,10 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
modal: true,
visible: false
});
confirm.show();

// If it is confirmed.
confirm.on('complete-yes', function() {

Large diffs are not rendered by default.

@@ -481,8 +481,10 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
modal: true,
visible: false
});
confirm.show();

// If it is confirmed.
confirm.on('complete-yes', function() {
@@ -277,8 +277,10 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
modal: true,
visible: false
});
confirm.show();

// If it is confirmed.
confirm.on('complete-yes', function() {
@@ -114,14 +114,16 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
event.detach();
var confirmation = {
modal: true,
visible : true,
visible : false,
centered : true,
title : M.util.get_string('confirmunassigntitle', 'role'),
question : M.util.get_string('confirmunassign', 'role'),
yesLabel : M.util.get_string('confirmunassignyes', 'role'),
noLabel : M.util.get_string('confirmunassignno', 'role')
};
new M.core.confirm(confirmation).on('complete-yes', this.removeRoleCallback, this, user.get(USERID), roleid);
new M.core.confirm(confirmation)
.show()
.on('complete-yes', this.removeRoleCallback, this, user.get(USERID), roleid);
}, this);
this._loadAssignableRoles();
},

0 comments on commit 6f0776b

Please sign in to comment.
You can’t perform that action at this time.