From 748156c8aa05d5adb69ec239941dc9e463aa9bba Mon Sep 17 00:00:00 2001 From: sokumon Date: Mon, 6 Oct 2025 21:05:58 +0530 Subject: [PATCH] fix: check if the current route actually exists --- frappe/public/js/frappe/ui/dialog.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/ui/dialog.js b/frappe/public/js/frappe/ui/dialog.js index b30113620d..d58fc072df 100644 --- a/frappe/public/js/frappe/ui/dialog.js +++ b/frappe/public/js/frappe/ui/dialog.js @@ -248,7 +248,10 @@ frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup { show() { // show it - this.handle_focus(); + if (window.location.pathname.startsWith("/app")) { + this.handle_focus(); + } + if (this.animate) { this.$wrapper.addClass("fade"); } else { @@ -278,7 +281,7 @@ frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup { handle_focus() { const me = this; - if (frappe.get_route) { + if (frappe.get_route()) { if (frappe.get_route()[0] == "Form") { if (!me.last_focus) me.last_focus = document.activeElement; }