From 3fb9a278757afed025cd10fd5fd6ba2fb806680b Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 3 Aug 2021 13:49:01 +0530 Subject: [PATCH] fix: Check if there is any active element --- frappe/public/js/frappe/form/layout.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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(); + } } }