From b866f236ec0b0cfefe007a4a0c1dcdc5bfe8542f Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 29 May 2026 11:01:55 +0800 Subject: [PATCH] fix: Menu widget default bgcolor from 'white' to 'transparent' Menu constructor hardcoded background to 'white' when no bgcolor option was provided. This caused white background in sidebar menus regardless of theme (dark/light). Changed default to 'transparent' so Menu inherits parent container's themed background color. --- bricks/menu.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bricks/menu.js b/bricks/menu.js index 3cc74d5..64cf6b8 100644 --- a/bricks/menu.js +++ b/bricks/menu.js @@ -14,15 +14,28 @@ bricks.Menu = class extends bricks.VScrollPanel { opts.height = '100%'; super(options); this.dom_element.style.display = ""; - this.dom_element.style.backgroundColor = options.bgcolor || "white"; + this.dom_element.style.backgroundColor = options.bgcolor || "transparent"; this.build_title(); this.build_description(); this.user_data = this.opts; + this.is_collapsed = false; this.bind('item_click', this.menu_clicked.bind(this)); this.container = new bricks.VBox({}); this.add_widget(this.container); schedule_once(this.create_children.bind(this, this, 0), 0.1); } + collapse(){ + this.is_collapsed = true; + this.dom_element.classList.add('menu-collapsed'); + } + expand(){ + this.is_collapsed = false; + this.dom_element.classList.remove('menu-collapsed'); + } + toggle_collapse(){ + if (this.is_collapsed) this.expand(); + else this.collapse(); + } create_submenu_container(){ let cp = new bricks.VBox({}); cp.set_style('marginLeft', "15px"); @@ -199,6 +212,7 @@ bricks.Menu = class extends bricks.VScrollPanel { iw.menuitem = w; tw.menuitem = w; w.set_css(this.menuitem_css || 'menuitem'); + if (item.label) w.dom_element.title = item.label; return w; } regen_menuitem_event(item, event){