fix: check if the current route actually exists

This commit is contained in:
sokumon 2025-10-06 21:05:58 +05:30
parent 09c1d84a45
commit 748156c8aa

View file

@ -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;
}