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

Popup menus that request focus are not shown on Linux with Wayland

XMLWordPrintable

    • b25
    • 22
    • b08
    • generic
    • linux

      ADDITIONAL SYSTEM INFORMATION :

      | affected | not affected | JDK Version | OS | Windowing System |
      |----------|--------------|---------------------------|--------------------|------------------|
      | X | | Oracle OpenJDK 23 | Ubuntu 24.04.1 LTS | Wayland |
      | | X | Oracle OpenJDK 23 | Fedora Linux 39 | X11 |
      | X | | Oracle OpenJDK 23 | Fedora Linux 39 | Wayland |
      | X | | Eclipse Temurin 22.0.2 | Ubuntu 24.04.1 LTS | Wayland |
      | X | | Eclipse Temurin 21.0.4 | Ubuntu 24.04.1 LTS | Wayland |
      | | X | Eclipse Temurin 21.0.3 | Fedora 37 | x11 |
      | | X | Eclipse Temurin 21.0.2 | Centos 7 (alm005) | x11 - VNC |
      | | X | Amazon Corretto 21.0.2 | Fedora Linux 39 | X11 |
      | X | | Amazon Corretto 21.0.2 | Fedora Linux 39 | Wayland |
      | | X | Eclipse Temurin 20.0.2 | Ubuntu 24.04.1 LTS | Wayland |
      | | X | Amazon Corretto 20.0.2 | Fedora Linux 39 | X11 |
      | | X | Amazon Corretto 20.0.2 | Fedora Linux 39 | Wayland |
      | | X | Eclipse Temurin 19.0.2 | Ubuntu 24.04.1 LTS | Wayland |
      | | X | Amazon Corretto 19.0.2 | Fedora Linux 39 | X11 |
      | | X | Amazon Corretto 19.0.2 | Fedora Linux 39 | Wayland |
      | | X | Eclipse Temurin 17.0.12 | Ubuntu 24.04.1 LTS | Wayland |
      | | X | Amazon Corretto 17.0.12 | Fedora Linux 39 | X11 |
      | | X | Amazon Corretto 17.0.12 | Fedora Linux 39 | Wayland |
      | | X | Eclipse Temurin 1.8.0_422 | Ubuntu 24.04.1 LTS | Wayland |
      | | X | OpenJDK 21 | KUbuntu 22.04 LTS | X11 |
      | | X | Amazon Corretto 1.8.0_402 | Fedora Linux 39 | X11 |
      | | X | Amazon Corretto 1.8.0_402 | Fedora Linux 39 | Wayland |


      A DESCRIPTION OF THE PROBLEM :
      When opening a JPopupMenu ` with a `JMenu` having components that request/receive focus (e.g. text field or button), then the menu and its contents as well as the popup hide. (the menu is made visible, but immediately hidden, the popup hides as well).

      Seems to only occurs if the menu is outside the invoker window.
      We assume this is because in this case a heavy-weight window is used.

      This is most likely related to:
      https://bugs.openjdk.org/browse/JDK-8319103



      REGRESSION : Last worked in version 20

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Execute the attached source code
      - Right click on the centered `JLabel`
      - Hover over the shown `JPopup`

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A sub-menu with a `JButton` should popup up
      which should displays the text "If you see me, the menu did not hide!".
      ACTUAL -
      The entire popup window closes and nothing is shown except for the
      `JFrame` with the centered `JLabel`.

      ---------- BEGIN SOURCE ----------

      import javax.swing.*;
      import java.awt.Dimension;

      public class CrashingJPopupRegression {
          public static void main(String... args) {
              JLabel rightClickMe = new JLabel("<html>Right Click Me<br>Java version " + System.getProperty( "java.version" ), SwingConstants.CENTER);
              rightClickMe.setPreferredSize(new Dimension(200,180));
              rightClickMe.setComponentPopupMenu(buildFailingPopup());
              JFrame frame = new JFrame();
              frame.setLocationRelativeTo(null); // Initial centering!
              frame.add(rightClickMe);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
          }
          private static JPopupMenu buildFailingPopup() {
              JPopupMenu failingPopup = new JPopupMenu();
              JMenu aCrashingMenu = new JMenu("hover me to try seeing the sub-menu.");
              aCrashingMenu.add(new JButton("If you see me, the menu did not hide!"));
              failingPopup.add(aCrashingMenu);
              return failingPopup;
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No workaround found.

      FREQUENCY : always


            azvegint Alexander Zvegintsev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: