From 2bcdcbbed7a680870e3a65c08c5c5d70790509eb Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Sun, 1 Mar 2026 21:58:20 -0800 Subject: [PATCH] Fix subcategory expand/collapse in visual menu editor Subcategories shared expandedCategoryId with parent categories, so clicking a subcategory collapsed the parent. Added separate expandedSubCategoryId state so subcategories expand independently. Co-Authored-By: Claude Opus 4.6 --- portal/menu-builder.html | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/portal/menu-builder.html b/portal/menu-builder.html index 810077c..fc62508 100644 --- a/portal/menu-builder.html +++ b/portal/menu-builder.html @@ -1227,6 +1227,7 @@ redoStack: [], idCounter: 1, expandedCategoryId: null, // For accordion - only one category expanded at a time + expandedSubCategoryId: null, // For subcategory accordion - independent of parent expandedItemId: null, // For item accordion - only one item expanded at a time expandedModifierIds: new Set(), // Track which modifiers are expanded @@ -4210,12 +4211,12 @@
${hasSubcats ? subcategories.map(subcat => { - const subExpanded = this.expandedCategoryId === subcat.id; + const subExpanded = this.expandedSubCategoryId === subcat.id; return `
-
+
@@ -4227,7 +4228,7 @@
-
+
${this.escapeHtml(subcat.name)}
${subcat.items.length} items
@@ -4502,6 +4503,19 @@ this.expandedCategoryId = null; } else { this.expandedCategoryId = categoryId; + this.expandedSubCategoryId = null; + this.expandedItemId = null; + this.expandedModifierIds.clear(); + } + this.render(); + }, + + // Toggle subcategory expanded/collapsed (independent of parent) + toggleSubCategory(subcatId) { + if (this.expandedSubCategoryId === subcatId) { + this.expandedSubCategoryId = null; + } else { + this.expandedSubCategoryId = subcatId; this.expandedItemId = null; this.expandedModifierIds.clear(); }