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

Menu keyboard navigation retains previous focus index

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • None
    • javafx

    Description

      This is split away from JDK-8164979, for ease of bug fixing. This issue covers the following issue:

      Incorrect selection while navigating between menu items. To reproduce:
      - select the first menu (by mouse or keyboard);
      - move the selection pointer to the second item by pushing DOWN key;
      - collapse menu by ESC key or select the second item;
      - select the first menu again;
      - press DOWN arrow key
      Third item will be selected. It seems that the the last selection state is restored.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.*;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class App extends Application {

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

          @Override
          public void start(Stage stage) throws Exception {
              MenuBar control = new MenuBar();
              for (int i = 0; i < 5; i++) {
                  Menu m = new Menu("Menu " + String.valueOf(i + 1));
                  for (int j = 0; j < 5; j++) {
                      m.getItems().add(new MenuItem("Item " + String.valueOf(j + 1)));
                  }
                  control.getMenus().add(m);
              }
              Scene scene = new Scene(new HBox(control));
              stage.setScene(scene);
              stage.show();
          }
      }

      Attachments

        Activity

          People

            jgiles Jonathan Giles
            jgiles Jonathan Giles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: