Merge pull request #37564 from GursheenK/scroll-to-param-in-url

This commit is contained in:
Suraj Shetty 2026-02-26 15:31:54 +05:30 committed by GitHub
commit d0d35cbb01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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) {