Problem
When a TableDelegate::context_menu() builds submenus via PopupMenuItem::submenu(label, entity), the submenu entity's parent_menu is not set. This causes submenu dismiss to not propagate to the parent context menu -- clicking a submenu item or clicking outside doesn't close the root menu.
This happens because the delegate runs in Context<TableState>, not Context<PopupMenu>, so it can't use PopupMenu::submenu() (which auto-wires parent_menu).
Solution
After the delegate's context_menu() returns, the table's .context_menu() handler iterates top-level Submenu items and sets parent_menu to the root context menu entity.
Also adds PopupMenu::set_parent_menu() public method for cases where submenus are built outside of PopupMenu::submenu().
Depends on: #2228 (SelectRow modifiers change touches the same code region)
Branch: boboshan/feat/submenu-parent-wire
Problem
When a
TableDelegate::context_menu()builds submenus viaPopupMenuItem::submenu(label, entity), the submenu entity'sparent_menuis not set. This causes submenu dismiss to not propagate to the parent context menu -- clicking a submenu item or clicking outside doesn't close the root menu.This happens because the delegate runs in
Context<TableState>, notContext<PopupMenu>, so it can't usePopupMenu::submenu()(which auto-wiresparent_menu).Solution
After the delegate's
context_menu()returns, the table's.context_menu()handler iterates top-levelSubmenuitems and setsparent_menuto the root context menu entity.Also adds
PopupMenu::set_parent_menu()public method for cases where submenus are built outside ofPopupMenu::submenu().Depends on: #2228 (SelectRow modifiers change touches the same code region)
Branch:
boboshan/feat/submenu-parent-wire