question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WinUI 3 Window.ExtendsContentIntoTitleBar caption buttons can be clicked when mouse is not over them

See original GitHub issue

Describe the bug

When a user presses the left mouse button down over a caption button (i.e., Minimize, Restore/Maximize, Close) in the title bar when the title bar has been customized using Window.ExtendsContentIntoTitleBar, the button will still be clicked even if the user has moved their mouse off of the button.

Steps to reproduce the bug

  1. Customize a WinUI 3 window where Window.ExtendsContentIntoTitleBar = true (you can use the WinUI 3 Gallery app as an example)
  2. Hover over the close button (this issue affects minimize and maximize as well), and click the left mouse button down
  3. Move the mouse away from the close button (the close button will still appear in the pressed visual state)
  4. Release the left mouse button
  5. The window will close

Expected behavior

The button should not be clicked if the left mouse button is released when cursor has moved off the caption button. Additionally, the button should not appear in the pressed visual state if the cursor is not over it.

Screenshots

The expected behavior when using the standard title bar:

https://user-images.githubusercontent.com/18747724/174465116-860ff8f9-c0cf-4b05-b3f1-ed36243f25b8.mp4

The problematic behavior when using Window.ExtendsContentIntoTitleBar:

https://user-images.githubusercontent.com/18747724/174465117-b02bdeac-caec-405f-a568-99c30534f76f.mp4

NuGet package version

WinUI 3 - Windows App SDK 1.1.1

Windows app type

  • ☐ UWP
  • 🗹 Win32

Device form factor

Desktop

Windows version

Windows 11 (22H2): Build 22621

Additional context

This is an important usability issue because these caption buttons behave differently from every other Windows caption buttons and has the potential to cause loss of work. If, for instance, a user inadvertently clicks their mouse button down on the close button, the window will close once they release the mouse button, and there is nothing they can do about it. The correct behavior would allow the user to move the cursor off the close button and safely release the mouse button.

Note that this issue only affects Window.ExtendsContentIntoTitleBar and not AppWindowTitleBar.ExtendsContentIntoTitleBar or the default title bar.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pratikonecommented, Apr 3, 2023

I am working to merge WinUI 3 custom titlebar with Appwindow titlebar in a way that winui 3 custom titlebar apis will internally call appwindow apis. so the behavior will start matching once that happens.

1reaction
pratikonecommented, Jan 25, 2023

Thanks for reporting this bug. I am looking into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Caption Buttons do not work when content is extended into ...
But now I noticed that the caption buttons (min, max, close) do not work. I can click them and for example the close...
Read more >
WinUI3 : How to remove Min Max Close button with tittle ...
How to get control over the Min, Max, and Close buttons when we use Window Title customization? I tried using Win32 APIs as...
Read more >
Full-screen, disable minimize/maximize for .NET MAUI ...
In this post we will learn how to make your .NET MAUI Windows app fullscreen or disable the maximize and minimize button on...
Read more >
Control the Window of your WinForms, WPF or Windows UI ...
Control the Window of your WinForms, WPF or Windows UI (WinUI) app using the Windows App SDK. November 26, 2021 by Nick. Code...
Read more >
Microsoft release Windows UI Library 3 Preview 4
WinUI is a user interface layer that contains modern controls and styles for building Windows apps, both Desktop and UWP.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found