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

PopupMenu closes as soon as it appears #81297

Open
Ymanawat opened this issue Sep 4, 2023 · 3 comments
Open

PopupMenu closes as soon as it appears #81297

Ymanawat opened this issue Sep 4, 2023 · 3 comments

Comments

@Ymanawat
Copy link
Contributor

Ymanawat commented Sep 4, 2023

Godot version

4.2 latest

System information

Godot v4.2.dev (f9004b52f) - Windows 10.0.22621 - Vulkan (Forward+)

Issue description

The popup menu closes as soon as it appears. This behavior appears to be triggered by the automatic selection of the first option in the list upon opening. It happens only when the list is large enough that requires scrolling.
here is the error I'm getting :

ERROR: Condition "index == -1" is true. Returning: Rect2i()
   at: subwindow_get_popup_safe_rect (scene\main\viewport.cpp:3513)

I want to solve this but not getting the exact problem and solution. Related to #73413 & #76480.

2023-09-04.14-36-05.mp4

Steps to reproduce

Run the attached project or

Create any OptionMenu add enough items that requires scroll.
Click on option menu and see it closes as soon as it appears.

Minimal reproduction project

optionmenu.zip

@Sauermann
Copy link
Contributor

The problem, you are describing is unrelated to the subwindow_get_popup_safe_rect-error message and you will find that the error-message has been (temporarily) removed in current master in #79937, because it is currently expected to happen.

You describe the behavior that:

  1. On Mouse-Button-Down the OptionMenu opens
  2. On Mouse-Button-Up the item, that is under the mousecursor is selected

The fact that the Menu is opened (in some conditions) at a position, where the mousecursor is located is problematic, because a quick mouse-down + mouse-up selects the item at that location.
From a usability point of view it would be better, if the menu is opened non-overlapping with the original OptionButton.

A different approach would be to open the Menu not on Mouse-Button-Down, but on Mouse-Button-Up.

@Ymanawat
Copy link
Contributor Author

Ymanawat commented Sep 4, 2023

The problem, you are describing is unrelated to the subwindow_get_popup_safe_rect-error message

I don't know it's related or not I was just getting this error only when I clicked on optionmenu and it gets closed.

the Menu is opened (in some conditions) at a position, where the mousecursor is located is problematic, because a quick mouse-down + mouse-up selects the item at that location.

I misunderstood the behaviour, because how the menu is behaving in a condition where we have fewer items feels different than when we have a large list. The response was too quick to notice.

@Ymanawat Ymanawat closed this as completed Sep 4, 2023
@Sauermann
Copy link
Contributor

Sauermann commented Sep 4, 2023

I am going to reopen this issue, because this is an usability problem that needs to be fixed.

@Sauermann Sauermann reopened this Sep 4, 2023
@Sauermann Sauermann changed the title PopupMenu closes as soon as it appears, error at subwindow_get_popup_safe_rect PopupMenu closes as soon as it appears Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants