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

[macos] Keyboard focus no longer works in the main application's text component

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Mac OS Catalina 10.15.5, Java 8 or 14

      A DESCRIPTION OF THE PROBLEM :
      We have a Java application named Oxygen XML Editor based on a JFrame which displays text content in JTextArea's. Sometimes for example after another dialog has been shown the focus no longer returns in the text area, the application is focused but it's like a glass pane over it prohibiting keyboard focus to the active JTextArea. In those cases you need to switch to another application and back on Mac, then the Java application can again focus in the text component.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a small Java application with a JFrame and a JTextArea, somehow show a dialog on top of that JFrame, sometimes after the dialog is closed the JTextArea cannot receive keyboard focus anymore. I'm afraid this does not happen all the time, you need to work with the application for some time.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The JTextArea cannot be focused anymore, you click inside it but it's like a glass pane is on top of it.
      ACTUAL -
      The JTextArea should be focusable.

      ---------- BEGIN SOURCE ----------
      I'm afraid I do not have a test case for this. I looked at the AWT thread when the problem occurred, it was not blocked in any way, it was waiting on the event queue for the next event to arrive:

      "AWT-EventQueue-0" #12 prio=6 os_prio=31 tid=0x00007f9621a36000 nid=0xb93b waiting on condition [0x0000700001a6d000]
         java.lang.Thread.State: WAITING (parking)
              at sun.misc.Unsafe.park(Native Method)
              - parking to wait for <0x000000078067e3a0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
              at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
              at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
              at java.awt.EventQueue.getNextEvent(EventQueue.java:554)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:187)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Switch to another application on Mac using Command-Tab and then switch back.

      FREQUENCY : occasionally


            skodandarama Suman Rajkumaar Kodandarama (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: