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

Keyboard traversal of menubar with hidden menu is broken

XMLWordPrintable

      Similiar to RT-40689 but on a higher level; if a menubar contains a hidden menu (keyboard traversal does not work). If you start the following application and press F10 and Down, the menu will not open.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class MenuNavigationWithHiddenMenu extends Application {

          public MenuNavigationWithHiddenMenu() {
          }

          @Override
          public void start(Stage stage) throws Exception {
              stage.setTitle("Menu navigation with hidden item");
              Scene scene = new Scene(new VBox(), 400, 350);
       
              MenuBar menuBar = new MenuBar();
              Menu hiddenMenu = new Menu("Hidden");
              hiddenMenu.getItems().addAll(new MenuItem("never to be seen"));
              hiddenMenu.setVisible(false);
              Menu menuFile = new Menu("File");
              menuBar.getMenus().addAll(hiddenMenu, menuFile);
              menuFile.getItems().addAll(new MenuItem("New"), new MenuItem("Open"), new MenuItem("Quit"));
              
              ((VBox) scene.getRoot()).getChildren().addAll(menuBar);
       
              stage.setScene(scene);
              stage.show();
          }
          
          public static void main(String[] args) {
              launch(args);
          }
      }

            Unassigned Unassigned
            rlichtenbjfx Robert Lichtenberger (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Imported: