From f0561844d86f7bed22a46505895f9aa797171d36 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Thu, 21 Jul 2011 12:23:11 +0200 Subject: [PATCH] don't close a menu item with a submenu A submenu item should only close the menu if it has a non default action. This is compliant with how Cocoa behavior. --- AppKit/CPMenu/_CPMenuManager.j | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AppKit/CPMenu/_CPMenuManager.j b/AppKit/CPMenu/_CPMenuManager.j index 7b1f2073a..abe9c15ee 100644 --- a/AppKit/CPMenu/_CPMenuManager.j +++ b/AppKit/CPMenu/_CPMenuManager.j @@ -230,7 +230,14 @@ var STICKY_TIME_INTERVAL = 500, else if (type === CPLeftMouseUp || type === CPRightMouseUp) { if (_hasMouseGoneUpAfterStartedTracking) + { + // Don't close the menu if the current item has a submenu + // and did not override it's default action + if ([activeItem action] === @selector(submenuAction:)) + return; + [trackingMenu cancelTracking]; + } else _hasMouseGoneUpAfterStartedTracking = YES; }