Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8181585

JPopupMenu (right-click context menu) flickers and disappears on certain Mac computers.

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      macOS Sierra v10.12.5

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Any of the recent MacBook Pro models with a Force Touch trackpad.

      A DESCRIPTION OF THE PROBLEM :
      The standard gesture for performing right-clicks on a MacBook trackpad is to place two fingers on the trackpad, and press down.

      In Java Swing applications that make use of right-click context menus (JPopupMenu), upon invoking a right-click menu, the menu will flicker for a fraction of a second, then disappear. This behavior is random and therefore very unpredictable; sometimes it works, sometimes not.

      The issue only happens when a right-click is performed by pressing down on the trackpad with two fingers, rather than tapping it with two fingers. However, tapping the trackpad to perform a right-click causes a brief delay before the context menu appears (this is a feature of the operating system due to the two-finger double-tap feature of the trackpad, which is used for zooming; ample time must be allowed to ensure that the tap was single vs. double), so it is generally preferred to click the trackpad in order to get a more instantaneous response.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Open a Java Swing application on a MacBook Pro (preferred), or any MacBook laptop with a Force Touch trackpad. Move the cursor over an object that supports right-clicking. Place two fingers on the trackpad as you normally would to right-click, then press down on the trackpad (do not tap).

      This behavior is very random, so you may need to try several times to reproduce the behavior.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The expected result is that the right-click context menu should appear and stay there until I have selected the option I want, or until I click away from the menu to dismiss it.
      ACTUAL -
      The actual result is that the menu flickers for a fraction of a second, then disappears.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No program errors or traceable problems occur; this is simply a UI behavior bug.

      REPRODUCIBILITY :
      This bug can be reproduced often.

      CUSTOMER SUBMITTED WORKAROUND :
      Possible workarounds include:
      - Tap the trackpad with two fingers instead of clicking; but this causes a delay in the menu's appearance (described above). This is a feature of the operating system, due to a two-finger double-tap gesture that is also available for the trackpad and is used for zooming. Therefore, a certain amount of delay time is needed to determine whether the user intended a double or single tap.
      - Use a mouse instead of the trackpad, but is inconvenient for users who do not have a mouse.

            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: