Skip to content

bug(mat-menu): Mat menu is always lazily loaded - itens are always destroyed upon closing #26474

Open
@djorge-ph

Description

@djorge-ph

Is this a regression?

  • No

The previous version in which this bug was not present was

No response

Description

On the documentation, it reads:
image

However, even when not using the ng-template, the items are always destroyed when the menu is closed.

I would like to have the items eagerly loaded, and on the menu closed, only hiding the items instead of destroying them.

Reproduction

Steps to reproduce:

  1. Got to the documentation page: https://material.angular.io/components/menu/overview
  2. On the basic menu
    image ,
    search for Item 1 on the page elements. You wont find the element.
  3. Open the basic menu and search again. This time you will find the menu item:
    image
  4. Close the menu and search again, the menu item will be gone.

Expected Behavior

I expect to see the mat items eagerly loaded, and only hidden when the mat menu is closed.

Actual Behavior

Mat items are always lazy-loaded. Mat items are destroyed when the menu is closed.

Environment

  • Angular: 14.2.4
  • CDK/Material: 14.1.2
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/menu

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions