From fbe4691d561b2b25ee2c75ddecb75c3ea2b1d3b9 Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Fri, 13 Mar 2026 06:23:56 +0530 Subject: [PATCH 1/6] fix(ux): don't override `Link To` if non-empty --- frappe/public/js/frappe/ui/sidebar/sidebar_editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js b/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js index 8b849382e8..7e724a2510 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js @@ -271,7 +271,11 @@ export class SidebarEditor { break; } - if (d.get_value("type") == "Link" && d.get_value("link_type") !== "URL") { + if ( + !d.get_value("link_to") && + d.get_value("type") == "Link" && + d.get_value("link_type") !== "URL" + ) { d.set_value("link_to", label); } From 723ed06ffb0082a14f2806cdb16a3fa7f863c0ea Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Fri, 13 Mar 2026 06:29:38 +0530 Subject: [PATCH 2/6] fix: show empty section breaks in edit mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * else how will we add the first child 😅 --- frappe/public/js/frappe/ui/sidebar/sidebar_item.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_item.js b/frappe/public/js/frappe/ui/sidebar/sidebar_item.js index 9267ab8740..9d74add3a3 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_item.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_item.js @@ -185,7 +185,7 @@ frappe.ui.sidebar_item.TypeSectionBreak = class SectionBreakSidebarItem extends this.full_template = $(this.wrapper); } make() { - if (this.nested_items.length == 0) { + if (this.nested_items.length == 0 && !frappe.app.sidebar.editor.edit_mode) { return; } super.make(); From 8590b25b19c489b6825d640ce117edab75379699 Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Fri, 13 Mar 2026 06:38:31 +0530 Subject: [PATCH 3/6] fix: prevent horizontal scroll in edit mode --- frappe/public/scss/desk/sidebar.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/public/scss/desk/sidebar.scss b/frappe/public/scss/desk/sidebar.scss index 5f8c479268..823584b1dc 100644 --- a/frappe/public/scss/desk/sidebar.scss +++ b/frappe/public/scss/desk/sidebar.scss @@ -306,6 +306,7 @@ display: flex; gap: 6px; width: 0; + overflow: hidden; } .standard-sidebar-item[data-name="add-sidebar-item"] { margin-top: 5px; From e1bb478303e9a9929a61d0f11b83eea8c6d6fa4e Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Fri, 13 Mar 2026 06:54:38 +0530 Subject: [PATCH 4/6] fix(ui): styling of sidebar item edit controls --- frappe/public/scss/desk/sidebar.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frappe/public/scss/desk/sidebar.scss b/frappe/public/scss/desk/sidebar.scss index 823584b1dc..f1724b52b7 100644 --- a/frappe/public/scss/desk/sidebar.scss +++ b/frappe/public/scss/desk/sidebar.scss @@ -83,6 +83,7 @@ .standard-sidebar-item { display: flex; + position: relative; @include transition(all, 0.3s, cubic-bezier(0.4, 0, 0.2, 1)); margin-bottom: 1px; @@ -292,7 +293,6 @@ .standard-sidebar-item:hover { & .sidebar-item-edit-controls { visibility: visible; - width: auto; } } .promotional-banners, @@ -303,10 +303,10 @@ } .sidebar-item-edit-controls { visibility: hidden; + position: absolute; + right: 0; display: flex; gap: 6px; - width: 0; - overflow: hidden; } .standard-sidebar-item[data-name="add-sidebar-item"] { margin-top: 5px; From 7feb58a6b6724e3e4954fc1fc0a461eb26cf8e1a Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Fri, 13 Mar 2026 06:56:49 +0530 Subject: [PATCH 5/6] fix: save fails for sidebar with nested items --- frappe/public/js/frappe/ui/sidebar/sidebar_editor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js b/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js index 7e724a2510..56c1ffc27c 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js @@ -84,6 +84,9 @@ export class SidebarEditor { } prepare_data() { this.new_sidebar_items.forEach((item) => { + if (item.parent) { + delete item.parent; + } if (!item.nested_items) return; item.nested_items.forEach((nested_item) => { if (nested_item.parent) { From 777d663cd0db4613bdcfd32707afa277f8a79335 Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Sat, 14 Mar 2026 06:20:30 +0530 Subject: [PATCH 6/6] fix: reordering between / across section break fails * since the indices become stale after reorder * we need to splice instead of swap --- .../js/frappe/ui/sidebar/sidebar_editor.js | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js b/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js index 56c1ffc27c..777fe07bf0 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_editor.js @@ -141,15 +141,15 @@ export class SidebarEditor { me.sorting = true; }, onEnd: function (event) { + if (event.from !== event.to) return; // onAdd handles this case + if (me.new_sidebar_items.length == 0) { me.new_sidebar_items = Array.from(me.workspace_sidebar_items); } let old_index = event.oldIndex; let new_index = event.newIndex; - me.new_sidebar_items[old_index]; - let b = me.new_sidebar_items[old_index]; - me.new_sidebar_items[old_index] = me.new_sidebar_items[new_index]; - me.new_sidebar_items[new_index] = b; + let [item] = me.new_sidebar_items.splice(old_index, 1); + me.new_sidebar_items.splice(new_index, 0, item); }, }); @@ -198,21 +198,16 @@ export class SidebarEditor { ); }, onEnd: function (event) { + if (event.from !== event.to) return; // onAdd handles this case + let new_index = event.newIndex; let old_index = event.oldIndex; - let item_label = $(event.item).data("id"); - me.new_sidebar_items.forEach((item) => { - if (item.nested_items.length) { - let child = item.nested_items.find( - (child) => child.label === item_label - ); - if (child) { - let b = item.nested_items[old_index]; - item.nested_items[old_index] = item.nested_items[new_index]; - item.nested_items[new_index] = b; - } - } - }); + let section_name = $(event.to).parent().attr("item-name"); + let section_data = me.get_item_data(section_name); + if (section_data && section_data.nested_items) { + let [item] = section_data.nested_items.splice(old_index, 1); + section_data.nested_items.splice(new_index, 0, item); + } }, }); });