From bc07920f1a6f7c379fa32ee70acc42be672bdf54 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 23 Jun 2026 14:29:06 +0545 Subject: [PATCH] refactor(src/window/panel/components): adjust top-level menu filtering to respect visibility Ensure only visible top-level items are considered Prevent hidden items from appearing in the menu hierarchy --- src/window/panel/components/globalmenu.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/window/panel/components/globalmenu.py b/src/window/panel/components/globalmenu.py index 31c16f7..415b818 100644 --- a/src/window/panel/components/globalmenu.py +++ b/src/window/panel/components/globalmenu.py @@ -369,9 +369,11 @@ class GlobalMenuDropdowns: pass self._dynamic_dropdowns.clear() - # Filter to top-level menu items only + # Filter to visible top-level menu items only top_level = [ - item for item in menu_items if hasattr(item, "label") and item.label + item + for item in menu_items + if hasattr(item, "label") and item.label and getattr(item, "visible", True) ] logger.info(f"[GlobalMenu] top_level after filter: {len(top_level)} items") @@ -402,6 +404,8 @@ class GlobalMenuDropdowns: # Build initial children for this dropdown dropdown_children = [] for child in item.children if item.children else []: + if not getattr(child, "visible", True): + continue dropdown_children.append(_menu_item_to_dropdown(child)) if not dropdown_children: @@ -442,6 +446,8 @@ class GlobalMenuDropdowns: if new_item.children else [] ): + if not getattr(child, "visible", True): + continue children.append( _menu_item_to_dropdown(child) )