From fb75fd0396d425ceef502c82c5f9f6c921ea3130 Mon Sep 17 00:00:00 2001 From: Thong Bui Date: Mon, 6 Apr 2020 12:02:43 +0700 Subject: [PATCH] MDL-68344 filepicker: File Picker focus lost on upload --- lib/form/filemanager.js | 1 + repository/filepicker.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index e766d16e712..168c11018cd 100644 --- a/lib/form/filemanager.js +++ b/lib/form/filemanager.js @@ -493,6 +493,7 @@ M.form_filemanager.init = function(Y, options) { // XXX: magic here, to let filepicker use filemanager scope options.magicscope = this; options.savepath = this.currentpath; + options.previousActiveElement = e.target.ancestor('a', true); M.core_filepicker.show(Y, options); }, diff --git a/repository/filepicker.js b/repository/filepicker.js index ad9644fff9a..2a41fac49ef 100644 --- a/repository/filepicker.js +++ b/repository/filepicker.js @@ -1422,7 +1422,9 @@ M.core_filepicker.init = function(Y, options) { width : width+'px', responsiveWidth : 768, height : '558px', - zIndex : this.options.zIndex + zIndex : this.options.zIndex, + focusOnPreviousTargetAfterHide: true, + focusAfterHide: this.options.previousActiveElement }); // create panel for selecting a file (initially hidden)