Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown Menu gets stuck on screen when window is not responding #16136

Closed
SirZeeno opened this issue Jun 26, 2024 · 5 comments
Closed

Dropdown Menu gets stuck on screen when window is not responding #16136

SirZeeno opened this issue Jun 26, 2024 · 5 comments
Labels
bug by-design The behavior reported in the issue is actually correct. os-windows

Comments

@SirZeeno
Copy link

Describe the bug

when the window that the dropdown menu goes into a not responding state and the dropdown was active when that happened, then the dropdown menu stays open and even stays in the foreground of the screen even if you do to a different window on your screen (screenshot for reference)

image

To Reproduce

have a dropdown menu open, press a button in that dropdown menu that will execute some code that will run on the main thread and make the UI go unresponsive, and click to a different window.

Expected behavior

the dropdown should stay on the window it belongs to and it shouldn't stay in the foreground when the window it belongs to isn't in the foreground.

Avalonia version

11.0.11

OS

Windows

Additional context

This is happening in the debug version of my program, so I am unsure if the release version has that fixed.

@SirZeeno
Copy link
Author

This is the repo to my project, and it happens when you press the copy button under the file dropdown. you will need to change the absolute file path though for the sqlite database in the AnimeContext file to the absolute path of the SQLiteTest.db file for it to not throw any errors in the current version of the project.

https://github.com/SirZeeno/Anime-Archive-Handler-GUI

@maxkatz6
Copy link
Member

@SirZeeno so, popup is kept on the screen while app is frozen, but properly hides when it unfrezes.
That's pretty much expected, since UI thread is busy with your code, and it can't hide the popup.

I would strongly advise you to not block UI thread doing any long operations. Move these operations to separated threads or use async alternatives.

@maxkatz6 maxkatz6 added by-design The behavior reported in the issue is actually correct. and removed needs-repro labels Jun 28, 2024
@SirZeeno
Copy link
Author

well of course i know not to block the Main thread where the UI is being handled, but its the fact that it acts like its own window, and doent get affected by minimizing the main window that I feel like is a bug, or am I wrong here?

@maxkatz6
Copy link
Member

@SirZeeno it is, in fact, its own window though. That's how popups work on many OS including Windows. Avalonia does hide them automatically, when window is not visible, but not when UI thread is frozen.

You can switch to overlay popups by adding:

.With(new Win32PlatformOptions
{
   OverlayPopups = true
});

in your AppBuilder. This configuration will force all popups to be part of the same parent window, which also will limit their positioning by the boundaries of the parent.

@SirZeeno
Copy link
Author

I wasn't aware of how they worked, I thought this was a bug of some kind. My bad and thanks for clearing this up for me. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug by-design The behavior reported in the issue is actually correct. os-windows
Projects
None yet
Development

No branches or pull requests

2 participants