Skip to content

[BUG] Undocumented breaking changes with Popup v2... #2792

Closed

Description

@Sebastian1989101

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

In the hopes of 12.1.0 fixes all the issues with Popup v2, a new major breaking change is part of it... OnAppearing and OnDisappearing are now called on the page when opening a popup... Why is stuff like this not documented? Just wasted multiple hours only to find it is from this update...

For whatever reason the popup now triggers these methods, it means that I have to rewrite a huge part of my app because I usually register/unregister events there... But popups that change data of the page behind it are now impossible to use for it...

Expected Behavior

Not calling OnDisappearing/OnDisappearing of the actual page that is "hosting" the popup...

Steps To Reproduce

Use buggy Popup v2

Link to public reproduction project repository

n/a

Environment

- .NET MAUI CommunityToolkit: 12.1.0
- OS: iOS/Android
- .NET MAUI: 9.0.81

Anything else?

No response

Activity

  1. VladislavAntonyuk commented on Jul 5, 2025

    @VladislavAntonyuk
    Contributor

    Popup is a "transparent" page that uses navigation, so your initial page will call OnAppearing / on disappearing.

  2. Sebastian1989101 commented on Jul 5, 2025

    @Sebastian1989101
    Author

    Popup is a "transparent" page that uses navigation, so your initial page will call OnAppearing / on disappearing.

    That was not the behavior on v1 and it is still not listed as breaking change even tho it is exactly that.

  3. bijington commented on Jul 5, 2025

    @bijington
    Contributor

    Thanks for highlighting this. I'll put something into the docs pages

  4. CyberZeus commented on Jul 7, 2025

    @CyberZeus

    Hi, I also noticed this problem.
    Unlike V1, the Popup V2 implementation calls the OnAppearing on the underlying page when you close the popup.
    This leads to malfunctions in my app, because if I open a popup in the OnAppearing event and then I close it, the execution flow breaks and another call to OnAppearing is made.
    If it needs to be so, I have to redesign huge code in my app.

    Can you simply remove the unnecessary call to OnAppearing when closing the Popup?

    To verify this, you can open CommunityToolkit_2703_repro, override OnAppearing on the MainPage and add Console.WriteLine("On appearing hit"); after base.OnAppearing();

    https://github.com/mfeingol/repros/tree/master/CommunityToolkit_2703_repro

    You'll see that OnAppearing, unlike V1, is called when you close the popup.

  5. bijington commented on Jul 7, 2025

    @bijington
    Contributor

    @CyberZeus we cannot remove this because it is .NET MAUI calling it and not the toolkit. I happens because a popup is now displayed in a modal ContentPage.

    I will add to the documentation and also have a PR that should help to make changes around this easier if you are using OnNavigatedTo which may be a better option instead of OnAppearing

  6. CyberZeus commented on Jul 7, 2025

    @CyberZeus

    @CyberZeus we cannot remove this because it is .NET MAUI calling it and not the toolkit. I happens because a popup is now displayed in a modal ContentPage.

    I will add to the documentation and also have a PR that should help to make changes around this easier if you are using OnNavigatedTo which may be a better option instead of OnAppearing

    Thank you, I understand this, now, popup is a modal ContentPage.
    I prefer Popup V1, I was able to implement it very quickly, but now with V2 I see more problems than benefits.

    By the way, don't know how to solve, both OnAppearing and OnNavigatedTo are called when I close the popup.

  7. bijington commented on Jul 7, 2025

    @bijington
    Contributor

    @CyberZeus we cannot remove this because it is .NET MAUI calling it and not the toolkit. I happens because a popup is now displayed in a modal ContentPage.
    I will add to the documentation and also have a PR that should help to make changes around this easier if you are using OnNavigatedTo which may be a better option instead of OnAppearing

    Thank you, I understand this, now, popup is a modal ContentPage. I prefer Popup V1, I was able to implement it very quickly, but now with V2 I see more problems than benefits.

    By the way, don't know how to solve, both OnAppearing and OnNavigatedTo are called when I close the popup.

    I appreciate it is a different way of doing things and it brings in its own behavioural differences - we had to make a move away from the original implementation because we had to fight with so many layout bugs that we felt it was best to rely on something .NET MAUI does well.

    For the OnNavigatedTo implementation it will become a lot easier once this PR #2767 merges but for the interim you could store whether you have navigated to the page already in a bool and return early if true. Then hopefully once this PR is in it could be cleaner - I would like to extend this further but I need to work out how first.

  8. bijington commented on Jul 7, 2025

    @bijington
    Contributor

    I have created this page that explains a little on the impact of showing/closing a Popup MicrosoftDocs/CommunityToolkit#578 I would really appreciate the community getting involved and letting me know if it needs more - it is difficult to lose the context and write it without knowing how it works so any extra input people can give would really help.

  9. CyberZeus commented on Jul 8, 2025

    @CyberZeus

    @bijington Thank you!
    Because closing a Popup opened in OnAppearing event causes loops and code flow breaks (OnAppearing continously hits and opens the same popup), I had to refactor my app and avoid opening popups on OnAppearing.

  10. bijington commented on Jul 9, 2025

    @bijington
    Contributor

    I'm closing this issue as we have the docs PR open

  11. locked and limited conversation to collaborators on Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions