From ec4b348369dd7748b08dde9ef251ad9b124f5210 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Thu, 15 Aug 2013 17:15:51 -0700 Subject: [PATCH] Fixed: a disabled CPMenuItem could still have a selected background Previously it was possible to have a highlighted CPMenuItem for a disabled CPMenuItem. (To get that, select an item, close the menu, disabled the item manually and then open the menu again). Now it is not possible to get this behavior. --- AppKit/CPMenuItem/CPMenuItem.j | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AppKit/CPMenuItem/CPMenuItem.j b/AppKit/CPMenuItem/CPMenuItem.j index 4db407605..480043bc1 100644 --- a/AppKit/CPMenuItem/CPMenuItem.j +++ b/AppKit/CPMenuItem/CPMenuItem.j @@ -166,6 +166,9 @@ var CPMenuItemStringRepresentationDictionary = @{ if (_isEnabled === isEnabled) return; + if (!isEnabled && [self isHighlighted]) + [_menu _highlightItemAtIndex:CPNotFound]; + _isEnabled = !!isEnabled; [_menuItemView setDirty];