diff --git a/client/src/views/fields/attachment-multiple.js b/client/src/views/fields/attachment-multiple.js index 496032ee5c..866a6128ef 100644 --- a/client/src/views/fields/attachment-multiple.js +++ b/client/src/views/fields/attachment-multiple.js @@ -575,7 +575,16 @@ function (Dep, FileUpload) { this.isUploading = false; - setTimeout(() => this.focusOnUploadButton(), 50); + setTimeout(() => { + if ( + document.activeElement && + document.activeElement.tagName !== 'BODY' + ) { + return; + } + + this.focusOnUploadButton(); + }, 50); } }) .catch(() => { diff --git a/client/src/views/fields/file.js b/client/src/views/fields/file.js index 533d2ee19e..d06866d496 100644 --- a/client/src/views/fields/file.js +++ b/client/src/views/fields/file.js @@ -604,6 +604,13 @@ define('views/fields/file', ['views/fields/link', 'helpers/file-upload'], functi this.isUploading = false; setTimeout(() => { + if ( + document.activeElement && + document.activeElement.tagName !== 'BODY' + ) { + return; + } + let $a = this.$el.find('.preview a'); $a.focus(); }, 50);