Skip to content

[BUG] Popup shown from modal page blocks modal stack after close. #2557

@dsarbut

Description

@dsarbut

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Showing a popup from a modal page and than closing it, causes the modal stack to be blocked and the app to hang when trying to pop the modal page.

Expected Behavior

Popping the modal page (await Navigation.PopModalAsync) should not hang.

Steps To Reproduce

  1. Clone this repo: https://github.com/dsarbut/PopupBug.git
  2. Open the solution, run it on Windows, Click the "Show Modal Page" button.
  3. Examine the output window. You should see:
    Showing Modal Page!
    Showing popup!
  4. Close the popup, either by pressing the "Close button" or by clicking outside.
  5. Examine the output window. You should see:
    Popup closed! Popping modal page.

You should also see:
Showing Main Page again., but this message is not present because Navigation.PopModalAsync hangs.

Code snippet:
` var modalPage = new ModalPage();

Debug.WriteLine("Showing Modal Page!");
await Navigation.PushModalAsync(modalPage);
Debug.WriteLine("Showing popup!");
await modalPage.ShowPopupAsync(new APopup());
Debug.WriteLine("Popup closed! Popping modal page.");
await Navigation.PopModalAsync();
Debug.WriteLine("Showing Main Page again.");`

Link to public reproduction project repository

https://github.com/dsarbut/PopupBug.git

Environment

- .NET MAUI CommunityToolkit: 11.1.0
- OS: Windows
- .NET MAUI: 9.0.40

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions