MDL-68344 filepicker: File Picker focus lost on upload
authorThong Bui <qktc1422@gmail.com>
Mon, 6 Apr 2020 05:02:43 +0000 (12:02 +0700)
committerThong Bui <Thong.BuiVoQuoc@nashtechglobal.com>
Fri, 4 Sep 2020 02:30:59 +0000 (09:30 +0700)
lib/form/filemanager.js
repository/filepicker.js

index e766d16..168c110 100644 (file)
@@ -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);
         },
 
index ad9644f..2a41fac 100644 (file)
@@ -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)