diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js index 7d133cc43d..88e0463fa5 100644 --- a/frappe/public/js/frappe/form/layout.js +++ b/frappe/public/js/frappe/form/layout.js @@ -251,10 +251,12 @@ frappe.ui.form.Layout = class Layout { this.refresh_section_collapse(); } - document.activeElement.focus(); - - if (document.activeElement.tagName == 'INPUT') { - document.activeElement.select(); + if (document.activeElement) { + document.activeElement.focus(); + + if (document.activeElement.tagName == 'INPUT') { + document.activeElement.select(); + } } }