fix: use scroll_to param in url strictly for fields

This commit is contained in:
Gursheen Anand 2026-02-26 12:53:24 +05:30
parent 0d4ec69e64
commit 372ce74ca9

View file

@ -1574,15 +1574,10 @@ frappe.ui.form.Form = class FrappeForm {
var scroll_to = frappe.route_options.scroll_to;
delete frappe.route_options.scroll_to;
var selector = [];
for (var key in scroll_to) {
var value = scroll_to[key];
selector.push(repl('[data-%(key)s="%(value)s"]', { key: key, value: value }));
}
selector = $(selector.join(" "));
if (selector.length) {
frappe.utils.scroll_to(selector);
if (this.scroll_to_field(scroll_to)) {
const url = new URL(window.location);
url.searchParams.delete("scroll_to");
history.replaceState(null, null, url);
}
} else if (window.location.hash) {
if ($(window.location.hash).length) {