JDK-8072900 : [macosx] Mouse events are captured by the wrong menu in OS X
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u31,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2015-02-11
  • Updated: 2015-09-29
  • Resolved: 2015-03-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9 b56Fixed
Description
When a page containing 2 applets with MenuItems (on the mac platform), it appears that the state of the Menu(s) are intermixed between the 2 applets.

Mac OS X 10.9 / FF 35.0.1 / Safari 7.1.3 / 1.8.0_40-ea-b22

Testcase & Reproduction Instructions
------------------------------------
1.  Deploy attached testcase.tar.gz
2.  Browse to demo.html, either FF or Safari
3.  Mouse over the Menu (both applets does not show MenuItems)
4.  Click on Left Menu.
5.  Move mouse over to right applet.
6.  The Menu on right shows the MenuItems.

This is a Sustaining managed bug. 
Comments
Testcase: import sun.awt.SunToolkit; import javax.swing.*; import java.awt.*; public class AltCharAcceleratorTest { public AltCharAcceleratorTest() throws Exception { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { { JFrame f = new JFrame("frame"); JMenuBar mb = new JMenuBar(); JMenu m1 = new JMenu("File"); JMenuItem i1 = new JMenuItem("Save"); JMenuItem i2 = new JMenuItem("Load"); f.setJMenuBar(mb); mb.add(m1); m1.add(i1); m1.add(i2); JMenu other = new JMenu("Other"); other.add(new JMenuItem("One")); other.add(new JMenuItem("Two")); mb.add(other); f.setLayout(new FlowLayout()); f.setSize(200, 200); f.setVisible(true); } } { JFrame f = new JFrame("frame"); JMenuBar mb = new JMenuBar(); JMenu m1 = new JMenu("File"); JMenuItem i1 = new JMenuItem("Save"); JMenuItem i2 = new JMenuItem("Load"); f.setJMenuBar(mb); mb.add(m1); m1.add(i1); m1.add(i2); JMenu other = new JMenu("Other"); other.add(new JMenuItem("One")); other.add(new JMenuItem("Two")); mb.add(other); f.setLayout(new FlowLayout()); f.setSize(200, 200); f.setVisible(true); } }); } public static void main(String[] args) throws Exception { AltCharAcceleratorTest t = new AltCharAcceleratorTest(); } }
26-02-2015

The problem could be reproduced with a standalone Java app, which creates two JFrames with menus. Open the menu in one Frame then move mouse over the menu in another Frame - the menu will be opened. The reason is that the AquaMenuUI creates its own MouseHandler and the logic of mouseEnter() has not been completely ported from the BasicMenuUI. We need to check whether the current toplevel menu is the same as toplevel selected path item.
26-02-2015