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

[ListView] Item selected with arrow key does not get scrolled into view.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • javafx
    • None

      List View item does not get scrolled into view while selecting with keyboard arrow keys.

      Run below program & follow the steps to reproduce.

      ---------------------------------------------------------------------------------------
      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.geometry.Orientation;
      import javafx.scene.Scene;
      import javafx.scene.control.ListView;
      import javafx.scene.layout.Pane;
      import javafx.stage.Stage;

      public class ListViewBug extends Application {

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

          @Override
          public void start(Stage stage) {
              ObservableList<String> vertListItems = FXCollections.<String>observableArrayList();
              for (int i = 0; i < 3000; ++i) {
                  vertListItems.add("" + i);
              }

              ListView<String> vList = new ListView<>(vertListItems);
              vList.setOrientation(Orientation.VERTICAL);
              vList.setPrefSize(120, 70);

              Pane pane = new Pane();
              pane.getChildren().add(vList);

              Scene scene = new Scene(pane);
              stage.setScene(scene);
              stage.show();
          }
      }
      ---------------------------------------------------------------------------------------

      STEPS:
      Issue1:
      1. In List View, scroll down to end with mouse & select last item, "2999"
      2. Press up arrow key (4 times, or more), & keep observing
      3. When Item "2995" (or previous) gets selected, it will NOT be visible in the list view.

      Issue2:
      1. In List View, scroll down with mouse towards end & select any item around "2900"
      2. Press & hold down arrow key to scroll till end.
      3. Observe that the last item "2999" gets selected but it is NOT visible in the view.

      Similar issue can be observed with Horizontal list view & left-right arrow keys.

            arapte Ambarish Rapte
            arapte Ambarish Rapte
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: