ComboBox click-through

Hi guys,

I’m using a combobox with a slight transparency in the popupmenu, but sometimes mouse clicks get through the transparency and clicks what’s under the menu. I guess overriding mouseDown won’t help, since the popup is created on the fly by the showPopup method.

Any advice on how to avoid the clickthrough?


After some testing, it looks that the click passes even if the popup menu is opaque.

Schermata 2022-01-31 alle 15.05.39

If I click on the selected item in the list, the item behind that menu gets clicked too.

That’s really strange.

Looks like the issue was caused by a lambda I used to add the “Open presets folder” to the menu:

menu.addItem("Open presets folder", [this] { showPresetsFolder(); });

I changed that to a more traditional addItem(id, “blabla”, true, false) and triggering the method from comboBoxPopupMenuFinishedCallback. It works fine now, but I don’t understand why the [this] capture is triggering if I don’t explicitly click on that item.

This sounds like it’s probably a bug in the PopupMenu. Are you able to provide any more details that might help us to track down the issue? e.g. What platform are you using for testing? Is there anything special about how you are showing your menus? Have you seen the same issue in any of the JUCE demo projects?

Hi Reuk,

this is happening on live products, so we have a variety of users that notified us about the issue: windows, mac, any kind of DAW.

The method I use to show and close the menu is nothing special. I’m using that since forever. What changed is that now I’m using multiple columns.

void showPopup() override
            PopupMenu menu;
            menu.setLookAndFeel (&getLookAndFeel());
            presetNumber = 0;
            addFilesToMenu(&menu, currentPresetFolder);
            menu.addItem("Open presets folder", [this] { showPresetsFolder(); });
            menu.showMenuAsync (PopupMenu::Options().withTargetComponent (this)
                                .withItemThatMustBeVisible (getSelectedId())
                                .withMinimumWidth (getWidth())
                                .withMaximumNumColumns (newMaxColumns)
                                .withStandardItemHeight (20),
                                ModalCallbackFunction::forComponent (comboBoxPopupMenuFinishedCallback, this));
static void comboBoxPopupMenuFinishedCallback (int result, ComboBox* combo)
            if (combo != nullptr)
                DBG("comboBoxPopupMenuFinishedCallback: " << result);
                if (result != 0)
                    combo->setSelectedId (result-1);

There is a fix out on develop now addressing this issue