diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index 74d161749b..1d00ffd7f9 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -375,10 +375,13 @@ struct MenuWindow final : public Component addToDesktop (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses | lf.getMenuWindowFlags()); - - Desktop::getInstance().addGlobalMouseListener (this); } + // Using a global mouse listener means that we get notifications about all mouse events. + // Without this, drags that are started on a button that displays a menu won't reach the + // menu, because they *only* target the component that initiated the drag interaction. + Desktop::getInstance().addGlobalMouseListener (this); + if (options.getParentComponent() == nullptr && parentWindow == nullptr && lf.shouldPopupMenuScaleWithTargetComponent (options)) if (auto* targetComponent = options.getTargetComponent()) scaleFactor = Component::getApproximateScaleFactorForComponent (targetComponent);