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

MenuBar: Invisible Menu works incorrectly with keyboard arrows

XMLWordPrintable

    • b21
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "21.0.2" 2024-01-16
      OpenJDK Runtime Environment (build 21.0.2+13-58)
      OpenJDK 64-Bit Server VM (build 21.0.2+13-58, mixed mode, sharing)

      JavaFX - 21.0.1


      A DESCRIPTION OF THE PROBLEM :
      When some menu is invisible then menu bar doesn't work correctly when user uses keyboard left/right arrows to navigate.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run this code:

      public class JavaFxTest7 extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) {
              var menu0 = new Menu("M0");
              menu0.getItems().addAll(new MenuItem("1"), new MenuItem("2"), new MenuItem("3"));

              var menu1 = new Menu("M1");
              menu1.getItems().addAll(new MenuItem("1"), new MenuItem("2"), new MenuItem("3"));

              var menu2 = new Menu("M2");
              menu2.getItems().addAll(new MenuItem("1"), new MenuItem("2"), new MenuItem("3"));

              var menu3 = new Menu("M3");
              menu3.getItems().addAll(new MenuItem("1"), new MenuItem("2"), new MenuItem("3"));

              var menu4 = new Menu("M4");
              menu4.getItems().addAll(new MenuItem("1"), new MenuItem("2"), new MenuItem("3"));

              VBox root = new VBox();
              root.getChildren().addAll(new MenuBar(menu0, menu1, menu2, menu3, menu4));
              menu2.setVisible(false);

              var scene = new Scene(root, 400, 300);
              primaryStage.setScene(scene);
              primaryStage.show();
          }
      }

      After that click any menu and use keyboard(!) left and right arrows to navigate.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The menus should appear in the same way whether the user is using a mouse or a keyboard.
      ACTUAL -
      <LINK>

      FREQUENCY : always


            angorya Andy Goryachev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: