mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-71087 File picker: Focus lost after 'Create folder'
This commit is contained in:
parent
fc335f5ea0
commit
07cbbc9193
@ -238,7 +238,7 @@ M.form_filemanager.init = function(Y, options) {
|
||||
}, true);
|
||||
},
|
||||
/** displays message in a popup */
|
||||
print_msg: function(msg, type) {
|
||||
print_msg: function(msg, type, options) {
|
||||
var header = M.util.get_string('error', 'moodle');
|
||||
if (type != 'error') {
|
||||
type = 'info'; // one of only two types excepted
|
||||
@ -247,13 +247,17 @@ M.form_filemanager.init = function(Y, options) {
|
||||
if (!this.msg_dlg) {
|
||||
this.msg_dlg_node = Y.Node.create(M.form_filemanager.templates.message);
|
||||
var nodeid = this.msg_dlg_node.generateID();
|
||||
|
||||
var previousActiveElement = null;
|
||||
if (typeof options.previousActiveElement != 'undefined') {
|
||||
previousActiveElement = options.previousActiveElement;
|
||||
}
|
||||
this.msg_dlg = new M.core.dialogue({
|
||||
draggable : true,
|
||||
bodyContent : this.msg_dlg_node,
|
||||
centered : true,
|
||||
modal : true,
|
||||
visible : false,
|
||||
focusAfterHide: previousActiveElement,
|
||||
});
|
||||
this.msg_dlg_node.one('.fp-msg-butok').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
@ -350,6 +354,7 @@ M.form_filemanager.init = function(Y, options) {
|
||||
centered : true,
|
||||
modal : true,
|
||||
visible : false,
|
||||
focusAfterHide: e.target.ancestor('a', true),
|
||||
});
|
||||
node.one('.fp-dlg-butcreate').set('id', 'fm-mkdir-butcreate-'+this.client_id).on('click',
|
||||
perform_action, this);
|
||||
@ -427,9 +432,12 @@ M.form_filemanager.init = function(Y, options) {
|
||||
e.preventDefault();
|
||||
var dialogOptions = {};
|
||||
var filenames = this.getSelectedFiles();
|
||||
var previousActiveElement = e.target.ancestor('a', true);
|
||||
|
||||
if (!filenames.length) {
|
||||
this.print_msg(M.util.get_string('nofilesselected', 'repository'), 'error');
|
||||
var options = {};
|
||||
options.previousActiveElement = previousActiveElement;
|
||||
this.print_msg(M.util.get_string('nofilesselected', 'repository'), 'error', options);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -439,6 +447,7 @@ M.form_filemanager.init = function(Y, options) {
|
||||
};
|
||||
dialogOptions.header = M.util.get_string('confirm', 'moodle');
|
||||
dialogOptions.message = M.util.get_string('confirmdeleteselectedfile', 'repository', filenames.length);
|
||||
dialogOptions.previousActiveElement = previousActiveElement;
|
||||
dialogOptions.callbackargs = [params];
|
||||
dialogOptions.callback = function(params) {
|
||||
this.request({
|
||||
@ -861,13 +870,20 @@ M.form_filemanager.init = function(Y, options) {
|
||||
this.confirm_dlg_node = Y.Node.create(M.form_filemanager.templates.confirmdialog);
|
||||
var node = this.confirm_dlg_node;
|
||||
node.generateID();
|
||||
|
||||
var previousActiveElement = null;
|
||||
if (typeof dialog_options.previousActiveElement != 'undefined') {
|
||||
previousActiveElement = dialog_options.previousActiveElement;
|
||||
}
|
||||
|
||||
this.confirm_dlg = new M.core.dialogue({
|
||||
draggable : true,
|
||||
bodyContent : node,
|
||||
centered : true,
|
||||
modal : true,
|
||||
visible : false,
|
||||
buttons : {}
|
||||
buttons : {},
|
||||
focusAfterHide: previousActiveElement,
|
||||
});
|
||||
var handle_confirm = function(ev) {
|
||||
var dlgopt = this.confirm_dlg.dlgopt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user