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

Disabled MenuItems within contextMenu are traversable through keyboard

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description

      FULL PRODUCT VERSION :
      java 8 update 162

      ADDITIONAL OS VERSION INFORMATION :
      Win 8 64 bit

      A DESCRIPTION OF THE PROBLEM :
      using arrows of keyboard to select MenuItem within contextMenu is difficult because of disabled MenuItems

      i have context menu that contain 10 hidden elements and 3 visible elements so i have to press 10 times on down arrow to select the first visible element

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      click on "hello" Label by mouse right to show the contextmenu
      try to use keyboard Arrows to select Menu Items

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      keyboard arrow select visible menuItem only

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /*
       * To change this license header, choose License Headers in Project Properties.
       * To change this template file, choose Tools | Templates
       * and open the template in the editor.
       */
      package javafxapplication16;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.ContextMenu;
      import javafx.scene.control.Label;
      import javafx.scene.control.MenuItem;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      /**
       *
       * @author manar
       */
      public class NewFXMain extends Application {

          @Override
          public void start(Stage primaryStage) {
              Label l = new Label("Hello");

              MenuItem[] items = new MenuItem[63];

              for (int i = 0; i < 30; i++) {
                  MenuItem m = new MenuItem("Invisible Item" + i);
                  m.setVisible(false);
                  m.setDisable(false);
                  items[i] = m;
              }

              for (int i = 30; i < 33; i++) {
                  MenuItem m = new MenuItem("Visible Item" + i);
                  items[i] = m;
              }
              for (int i = 33; i < 60; i++) {
                  MenuItem m = new MenuItem("Invisible Item" + i);
                  m.setVisible(false);
                  m.setDisable(false);
                  items[i] = m;
              }
              for (int i = 60; i < 63; i++) {
                  MenuItem m = new MenuItem("Visible Item" + i);
                  items[i] = m;
              }
              ContextMenu ctx = new ContextMenu(items);

              l.setContextMenu(ctx);

              StackPane root = new StackPane();
              root.getChildren().add(l);

              Scene scene = new Scene(root, 300, 250);

              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);
              primaryStage.show();
          }

          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              launch(args);
          }

      }

      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              bvaidya Balchandra Vaidya
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: