diff --git a/api/js/etemplate/et2_widget_htmlarea.ts b/api/js/etemplate/et2_widget_htmlarea.ts
index bf23569e33..e1432ae7a5 100644
--- a/api/js/etemplate/et2_widget_htmlarea.ts
+++ b/api/js/etemplate/et2_widget_htmlarea.ts
@@ -305,13 +305,14 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
self.resetDirty();
if (self.editor && self.editor.editorContainer)
{
+ const activeElement = document.activeElement;
self.editor.formatter.toggle(rte_formatblock);
jQuery(self.editor.editorContainer).height(self.options.height);
jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function(){
if (jQuery('#dragover-tinymce').length < 1) jQuery("").appendTo('head');
});
- //set back focus to the first field in the form
- self.getInstanceManager().focusOnFirstInput();
+ // give focus back
+ activeElement && activeElement.focus && activeElement.focus();
}
});
}