microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

SDK v1.8.0: Hovering on modal window triggers pointer events of the owner window's button

Open d2phap opened this issue 3 months ago • 6 comments

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?

  • PointerEntered and PointerExited event 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

  1. Open WinUI 3 Gallery, go to Windowing > AppWindow
  2. Click the "Show modal window" button
  3. Move cursor to the modal window
  4. The "Show modal window" button is flashing (it's a bit hard to see because of the button background)
  5. 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 PointerEntered and PointerExited event

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

Image

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

d2phap avatar Sep 06 '25 04:09 d2phap

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

whiskhub avatar Sep 06 '25 11:09 whiskhub

Upgraded to v1.8, the issue still persists.

d2phap avatar Sep 10 '25 13:09 d2phap

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!!!!

torum avatar Sep 11 '25 14:09 torum

https://github.com/user-attachments/assets/79dca94b-41cf-49b1-ae3b-100541f358fb

torum avatar Sep 19 '25 04:09 torum

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

d2phap avatar Sep 26 '25 09:09 d2phap

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.

NicholasChrzan avatar Nov 07 '25 17:11 NicholasChrzan