Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[Bug] Popup being dismissed when window is resized or loses focus

Open mjfara opened this issue 3 years ago • 7 comments

Description

Despite the following: CanBeDismissedByTappingOutsideOfPopup="False"

The popup is still being dismissed when the window is resized or it loses focus.

Steps to Reproduce

  1. Create a popup, set CanBeDismissedByTappingOutsideOfPopup to false
  2. Run app on Windows machine
  3. Open popup
  4. Resize window or click on another window to change focus

Expected Behavior

Expect the popup to not be dismissed

Actual Behavior

Popup is dismissed

Basic Information

  • Version with issue: 8.0.0-preview3

  • IDE: VS2022 Preview

  • Platform Target Frameworks:

    • UWP: 10.0.19041

mjfara avatar Apr 19 '22 14:04 mjfara

That is how the platform component (Flyout) works.

VladislavAntonyuk avatar Apr 19 '22 14:04 VladislavAntonyuk

Then perhaps a popup isn't the control I need for my use case. When using it as an edit form, the possibility of it being dismissed is not ideal.

Thanks.

mjfara avatar Apr 19 '22 14:04 mjfara

@pictos can we use this platform control instead https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.primitives.popup?view=winui-3.0

@mjfara, we still have some time before code freeze and GA. Thank you for your interest in MAUI Community Toolkit

VladislavAntonyuk avatar Apr 19 '22 14:04 VladislavAntonyuk

The control you linked is what I am used to on UWP, very similar functionality but would remain visible even on resize. In the past I had to subscribe to the window resize event in order to re-locate the popup on resize, if that can be built in, even better :)

Flyout is nice though as it can appear above a control.

I think these have 2 different use cases.

mjfara avatar Apr 19 '22 15:04 mjfara

yes, we try to get the best options of 2 controls and apply them in one popup. hope we won't need to create custom UserControl

VladislavAntonyuk avatar Apr 19 '22 15:04 VladislavAntonyuk

@pictos can we use this platform control instead https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.primitives.popup?view=winui-3.0

@mjfara, we still have some time before code freeze and GA. Thank you for your interest in MAUI Community Toolkit

I'm not sure... We need to check the APIs, from the docs that you linked looks like the Flyout is more powerful (?)

pictos avatar Apr 20 '22 02:04 pictos

Flyout works great until you switch to another window. An example of Flyout is Windows 11 Widgets: image This window is not resizable and automatically hides when it loses focus.

VladislavAntonyuk avatar May 20 '22 08:05 VladislavAntonyuk

Any update on this? I am seeing this issue still

SamJames101 avatar Dec 05 '22 11:12 SamJames101

I noticed that the Popup is not cleanly being dismissed, it just disappears. It does not trigger the OnClosed handlers but some cleanup seems to be done. I am not sure if the user code can properly handle this unexpected closing. A side effect of this is that if the user code programmatically closes the modal (after a timeout), it crashes into a NullReferenceException during cleanup.

UCIS avatar Dec 05 '22 12:12 UCIS

Reproduction sample: https://github.com/peterjgould/PopupResize.git https://github.com/SunshineSpring666/PopupCloseBug.git

VladislavAntonyuk avatar Jan 11 '23 15:01 VladislavAntonyuk