LuckyDucko / Mopups

Popups For MAUI
BSD 3-Clause "New" or "Revised" License
265 stars 48 forks source link

Mopups are hidden in background when called after MAUI FilePicker #124

Open askariya opened 3 months ago

askariya commented 3 months ago

Description

All Mopups appear to be hidden in the background when called after a FilePicker. This means the Mopup can't be closed at all so the app itself becomes impossible to interact with. To the naked eye it looks like the popup just never appears and the app freezes, but if you step through the creation of a popup you can see the popup briefly appear before it is immediately covered by the original calling page.

I've created a sample app that can reproduce the issue: https://github.com/askariya/MauiPopupsApp I originally noticed this while trying Prism Popups (that utilizes Mopups) and I have a project where it happens in Prism as well: https://github.com/askariya/MauiPrismMopupsSampleApp

Steps to Reproduce

  1. In a ViewModel, add a call to PickAsync() and follow it with a call to open a Popup Dialog:
  2. var fileData = await FilePicker.PickAsync(); result = await _dialogService.ShowDialogAsync(nameof(PopupNotificationDialog));
  3. Trigger the above call (ex: with a button press).
  4. Select a file or back out such that the File Picker closes.
  5. You will see that the popup does not appear and instead the Page you called from does.
  6. If you repeat this in debug mode with breakpoints for each step you can see that the Popup does appear but is covered by the calling Page immediately.

Video: https://github.com/LuckyDucko/Mopups/assets/15271126/95ada5ac-e43f-4473-97ee-dd9208b62a8b

Sofiya-kumar commented 2 months ago

@askariya I faced the same problem with the file picker. Try to add a delay with 100 ms and check this

askariya commented 2 months ago

@Sofiya-kumar Thanks for the suggestion; adding a Task.Delay(100) doesn't seem to work either, though. I think a change will need to be made to the Mopups code to avoid using a workaround like this anyway.