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

Keyboard traversal of menu with hidden menu item is broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8u45
    • javafx
    • Linux, Fedora 21
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      Example program:
      package prv.rli.codetest;

      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 MenuNavigationWithHiddenMenuItem extends Application {

          public MenuNavigationWithHiddenMenuItem() {
          }

          @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 menuFile = new Menu("File");
              menuBar.getMenus().addAll(menuFile);
              menuFile.getItems().addAll(new MenuItem("New"), new MenuItem("Hidden"), new MenuItem("Quit"));
              menuFile.getItems().get(1).setVisible(false);
       
              ((VBox) scene.getRoot()).getChildren().addAll(menuBar);
       
              stage.setScene(scene);
              stage.show();
          }
          
          public static void main(String[] args) {
              launch(args);
          }
      }

      If you start the program, open the File menu and use the <Down>-Key to traverse through the menu items, the focus will cycle like this (with each press of the <Down>-Key):
      * New
      * New
      * Quit
      instea of just:
      * New
      * Quit
      Interestingly, if you use <Tab>, things work as expected.

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

              Created:
              Updated:
              Resolved:
              Imported: