-
Notifications
You must be signed in to change notification settings - Fork 465
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
In some cases on Android, I noticed that the popup's background overlay wouldn't always hide along with its popup when navigating between pages, blocking the entire application, CanBeDismissedByTappingOutsideOfPopup does not matter.
iOS has not been tested yet at the moment.
The simplest case is to call PopToRootAsync 1 frame after calling ShowPopup, the popup's background overlay will stay on top forever.
private void OnClicked(object? sender, EventArgs e)
{
Dispatcher.DispatchAsync(async () =>
{
// Be sure to specify the background color to see the overlay.
var options = new PopupOptions()
{
PageOverlayColor = Colors.Green
};
// It doesn't matter what to show.
var view = new Label
{
Text = "Tap to dismiss this popup",
BackgroundColor = Colors.Red
};
// 1. Show the popup without waiting for it to close
Shell.Current.ShowPopup(view, options);
// 2. Wait for 1 frame.
await Task.Yield();
// 3. Finally, pop to root. The animated flag does not matter.
await Shell.Current.Navigation.PopToRootAsync(false);
/*
* Now the popup itself is gone, but we see it's green overlay.
* The model stack is empty! Optionaly we can navigate to another page
* in the regular navigation stack and see that the page has changed
* under overlay. Essentially, the app is frozen and won't respond to touch.
*/
await Shell.Current.Navigation.PushAsync(new Page1());
});
}
Expected Behavior
The overlay hides along with its popup, thereby not blocking the application.
Steps To Reproduce
- Open and debug on Android sample app: https://github.com/Bamich/popup-v2-overlay-bug
- Click the button
Link to public reproduction project repository
https://github.com/Bamich/popup-v2-overlay-bug
Environment
- .NET MAUI CommunityToolkit: 12.2.0
- .NET MAUI: 9.0.120
- OS: Android, API 33