fuo
June 29, 2026, 10:28am
3
This is specific to submenus, and the solutions you propose do not work in that case.
This behavior is hardcoded and cannot be changed, and is not the common behavior you find on native MacOS or Windows sub menus (and propably most Linux flavors as well).
In fact the problem has already been raised in the past:
Hello guys,
Just noticed that when opening a sub menu, it is either aligned on top with its parent item if the latter is in the top half of the screen, either aligned on bottom if the parent is in the bottom half of the screen.
Here is an example with the projucer:
[image][image]
Is there is any specific reason why it happens? This behavior looks weird to me…
The code in question is in juce_PopupMenu.cpp lines 670-671. Works as expected if I comment out those lines.
if (target.getCentreY()…
And this one with nice illustrations:
On the current dev branch, line 916 of juce_PopupMenu.cpp, in the struct MenuWindow final : public Component struct, there is some logic which I would consider a bug. It breaks convention for popup menus at large, and also goes against the intention of the option which sets the preferred popup direction.
y = target.getCentreY() > parentArea.getCentreY() ? jmax (parentArea.getY(), target.getBottom() - heightToUse) + border : target.getY() - border;
This is setting a sub menus popup direction ba…