Hi,
I have a case where this commit has broken the popupmenu position.
If the target area is at the bottom of the parent area, the menu used to show up fully (cf first image). Now it doesnt open fully, and you have to move the mouse around to see all the items (cf gif).
Below is a pip to reproduce.

PIP code
/*
BEGIN_JUCE_PIP_METADATA
name: BottomComboBoxApp
version: 1.0.0
vendor: You
website: https://example.com
description: Simple app with a ComboBox at the bottom.
dependencies: juce_core,
juce_events,
juce_data_structures,
juce_graphics,
juce_gui_basics,
juce_gui_extra
exporters: xcode_mac, vs2022
type: Component
mainClass: MainComponent
useLocalCopy: 1
END_JUCE_PIP_METADATA
*/
#include <JuceHeader.h>
//==============================================================================
class MainComponent : public juce::Component
{
public:
MainComponent()
{
for (int i = 1; i <= 10; ++i)
combo.addItem ("Item " + juce::String (i), i);
combo.setSelectedId (1, juce::dontSendNotification);
// Force popup menu parent to be the main component
combo.setLookAndFeel (&lookAndFeel);
addAndMakeVisible (combo);
setSize (420, 240);
}
~MainComponent() override
{
combo.setLookAndFeel (nullptr);
}
void resized() override
{
auto area = getLocalBounds().reduced (12);
combo.setBounds (area.removeFromBottom (32));
}
private:
//--------------------------------------------------------------------------
struct ComboBoxLNF : public juce::LookAndFeel_V4
{
juce::PopupMenu::Options getOptionsForComboBoxPopupMenu (juce::ComboBox& box,
juce::Label& label) override
{
auto options = juce::LookAndFeel_V4::getOptionsForComboBoxPopupMenu (box, label);
if (auto\* parent = box.findParentComponentOfClass<juce::Component>())
options = options.withParentComponent (parent);
return options;
}
};
ComboBoxLNF lookAndFeel;
juce::ComboBox combo;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent)
};

