diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d index 2d754884..87909009 100644 --- a/src/dlangui/platforms/common/platform.d +++ b/src/dlangui/platforms/common/platform.d @@ -1505,8 +1505,11 @@ class Window : CustomEventTarget { if (p is modal) break; if (!insideOneOfPopups) { - if (p.onMouseEventOutside(event)) // stop loop when true is returned, but allow other main widget to handle event - break; + if (event.action == MouseAction.ButtonDown) + return true; // mouse button down should do nothing when click outside when popup visible + if (p.onMouseEventOutside(event)) { + return true; // mouse button up should do nothing when click outside when popup visible + } } else { if (dispatchMouseEvent(p, event, cursorIsSet)) return true; diff --git a/src/dlangui/widgets/popup.d b/src/dlangui/widgets/popup.d index 21ca8956..b4cfc352 100644 --- a/src/dlangui/widgets/popup.d +++ b/src/dlangui/widgets/popup.d @@ -174,10 +174,10 @@ class PopupWidget : LinearLayout { if (visibility != Visibility.Visible) return false; if (_flags & PopupFlags.CloseOnClickOutside) { - if (event.action == MouseAction.ButtonDown) { + if (event.action == MouseAction.ButtonUp) { // clicked outside - close popup close(); - return false; + return true; } } if (_flags & PopupFlags.CloseOnMouseMoveOutside) {