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

Items of non-editable ComboBox cannot be selected using up/down keys

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      this change broke selecting combobox items via up/down arrows:
      https://github.com/openjdk/jfx/commit/77a183e70b1a8a94f2525d235ed22f6bb1dff86d#diff-b7552c89404b578338100a9dec6ad6bc8ff7efb87e732417cc187c1a41aa691bL51
      modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/ComboBoxListViewBehavior.java


      REGRESSION : Last worked in version 14

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Create a combobox with multiple items
      - Focus it
      - Press down


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      first item is selected
      ACTUAL -
      nothing happens

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      import java.util.List;

      public class App extends Application {

        @Override
        public void start(Stage primaryStage) throws Exception {
          var root = new StackPane();
          var scene = new Scene(root);
          primaryStage.setScene(scene);
          var box = new VBox();
          var text = new TextField();
          var comboBox = new ComboBox<String>();
          comboBox.itemsProperty().set(FXCollections.observableArrayList(List.of("foo", "bar")));
          box.getChildren().addAll(text, comboBox);
          root.getChildren().add(box);
          primaryStage.show();
        }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            arapte Ambarish Rapte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: