Skip to content

table: auto-wire parent_menu on delegate context_menu submenus #2229

@boboshan

Description

@boboshan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions