-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popup displayed behind modal #143
Comments
Same issue here. It also is affecting non-shell apps as well. Steps to reproduce:
.NET 9.0 |
Duplicate of #82 |
It's an extremely serious limitation. Hoping for a release that will fix this. |
Anyone have a workaround for this at all? |
We migrated to MCT Popups (https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/popup), and it was surprisingly easy to do. Not sure if that qualifies as a workaround, though :) |
Check out my pretty bleh workaround @arosanti. Since the way MAUI presents Modals changed in .NET 9, popups don't appear in front as Modals are their own fragments now. This is also alluded to in #82. To address this, I sticky taped the code in the See below for the workaround version of public class AndroidMopups : IPopupPlatform
{
private static FrameLayout? DecoreView => GetTopFragmentDecorView();
...
public Task AddAsync(PopupPage page)
{
...
var androidNativeView = handler.PlatformView as Android.Views.View;
DecoreView?.AddView(androidNativeView);
...
}
// TODO: This fixes https://github.com/LuckyDucko/Mopups/issues/82. But we should monitor and implement their fix when it's done
private static FrameLayout? GetTopFragmentDecorView()
{
if (Platform.CurrentActivity is not ComponentActivity componentActivity)
{
return null;
}
IList<AndroidX.Fragment.App.Fragment>? fragments = componentActivity.GetFragmentManager()?.Fragments;
if (fragments is null || !fragments.Any())
{
return null;
}
AndroidX.Fragment.App.Fragment topFragment = fragments[^1];
if (topFragment is AndroidX.Fragment.App.DialogFragment dialogFragment)
{
return dialogFragment.Dialog?.Window?.DecorView as FrameLayout;
}
return topFragment.Activity?.Window?.DecorView as FrameLayout;
}
...
} |
Can we expect an official fix in the short to medium term? |
Issue : Mopups displayed behind Shell Modals
How to reproduce :
Steps that work :
Steps with problems :
.Net version : 9.0
Tested platform : Android emulator
Repo for reproduction : https://github.com/NovaKs68/TestMaui
The text was updated successfully, but these errors were encountered: