SDK v1.8.0: Hovering on modal window triggers pointer events of the owner window's button
Describe the bug
I have a button to open a modal window with OverlappedPresenter using AppWindow, the mouse pointer of the button is still captured, and its events (PointerEntered and PointerExited) are constantly triggered when the modal window is opened.
Why is this important?
PointerEnteredandPointerExitedevent of the button are triggered constantly- Clicking the buttons from the modal window is sometimes not triggered (because the mouse pointer is still captured by the original button)
Steps to reproduce the bug
This can reproduce with WinUI 3 Gallery
- Open WinUI 3 Gallery, go to Windowing > AppWindow
- Click the "Show modal window" button
- Move cursor to the modal window
- The "Show modal window" button is flashing (it's a bit hard to see because of the button background)
- The issue stops only if you move your cursor out of the owner window, or make it lost focus
Actual behavior
The "Show modal window" button is flashing (it's a bit hard to see because of the button background)
Expected behavior
- The "Show modal window" button is not flashing
- The "Show modal window" button does not trigger
PointerEnteredandPointerExitedevent
Screenshots
Please look closely to the background of the "Show modal window" button, it's a bit hard to see because of the button background.
https://github.com/user-attachments/assets/ea381fae-0efa-484e-bcdd-15474e3206c9
NuGet package version
WinUI 3 - Windows App SDK 1.8.1
Windows version
Windows 11 (24H2): Build 26100
Additional context
The issue can be reproduced with WinUI 3 Gallery v2.7.0, see the video here: https://github.com/microsoft/microsoft-ui-xaml/issues/10758#issuecomment-3337804285
Probably same as https://github.com/microsoft/microsoft-ui-xaml/issues/10357 / https://github.com/microsoft/microsoft-ui-xaml/issues/10067 / https://github.com/microsoft/microsoft-ui-xaml/issues/10529 / https://github.com/microsoft/microsoft-ui-xaml/issues/10572
Upgraded to v1.8, the issue still persists.
Yes, I can confirm this issue still persists in 1.8.0 (1.8.250907003).
Besides that, it is just pain to DllImport("User32.dll".... SetWindowLong to set GWL_HWNDPARENT and EnableWindow to disable parent window besides setting IsModal property of OverlappedPresenter just to show a Modal window!!!!
https://github.com/user-attachments/assets/79dca94b-41cf-49b1-ae3b-100541f358fb
Tested with WinUI 3 Gallery v2.7.0, still can reproduce: Hovering on modal window title bar trigger the button PointerEnter/Leave event
https://github.com/user-attachments/assets/692dcaa6-a018-4d82-99a9-dbe61a122631
We're still seeing Pointer messages being randomly generated as well even after upgrading to 1.8.0. We suspect it has to do with this issue because flyouts and popups are not constrained which mostly means they are child windows under the hood.