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

Fix popups going off screen vertically (upwards) #220

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tcld
Copy link

@tcld tcld commented Sep 17, 2024

Imagine a popup menu being 60% as tall as your screen real estate. If you open this popup in the (vertical) center of the screen, the current algorithm to place it will recognize that there isn't enough space underneath the click position to display it (50% + 60% > 100%).
The popup is then shown above the click position without any further checks, despite there not being enough space available there, either. (50% - 60% < 0%)

This PR slightly modifies this behavior by adding a second check: If there isn't enough space above the click position, the menu is moved down as far as necessary to display it. (At this point in the code we know that the menu is small enough to fit on the screen, so we only have to consider where - not whether - to place the menu.)

This change affects all popup menus (e.g. on buttons and comboboxes), but it doesn't fully fix this issue when observed on comboboxes, since they might be parented in more complex ways, which affects where their popup-menus can be shown.

Stephan Ehlers added 2 commits September 4, 2024 09:52
Before, popup menus that couldn't "hang" downwards from their parents
position were simply moved up - still starting from their parents
position. If the space they were moved to was insufficient, however, the
popup menu would be cut off at the top.
Now the popup will move itself down as far as necessary in that case;
this will not solve cases where popup menus are simply too large for the
screen, but it will alleviate many in-between cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant