Offset of the PopupMenu on MacOS

Hello,

It seems that the juce::PopupMenu can’t appear at the very bottom of the screen on MacOS (tested with Juce 6.0.8 and 6.1.0 - not tested on Windows and Linux), the menu is shifted by a few pixels to the top.

In this example, the juce::PopupMenu is attached to the juce::TextButton “Click Me” positioned at the bottom left corner of the window.

The window is not close to the bottom of the screen:
Capture d’écran 2021-08-26 à 09.40.43

The window is close to the bottom of the screen:
Capture d’écran 2021-08-26 à 09.40.32

Code:

MainComponent::MainComponent()
{
    button.onClick = [&]()
    {
        juce::PopupMenu menu;
        menu.addItem ("Item 1", nullptr);
        menu.addItem ("Item 2", nullptr);
        menu.showMenuAsync(juce::PopupMenu::Options().withTargetComponent (button));
    };
    addAndMakeVisible (button);
    setSize (600, 400);
}

void MainComponent::resized()
{
    button.setBounds (getLocalBounds().removeFromBottom (20).removeFromLeft (80));
}

Thanks for reporting. I’ve put a fix together, and it will be on develop shortly after the next bugfix release.

1 Like

This issue should be fixed here:

1 Like