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

[Traversal] Focus traversal in a virtual flow becomes random after scrolling

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8u20
    • 8u20
    • javafx

    Description

      If a ListView contains traversable items, after you scroll the list, the traversal order becomes random.
      Run the sample below. Focus should be on the first CheckBox. Tab and notice the focus moves down the list. Now scroll the list down and back up. Start off again at the first CheckBox and hit tab a few times to see that the focus jumps around.

      public class Main extends Application {

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

          static class Data {
              String lbl;
              ObservableBooleanValue selected;
              Data(String lbl) { this.lbl = lbl; this.selected = new SimpleBooleanProperty(false); }
              @Override public String toString() { return lbl; }
          }

          @Override
          public void start(final Stage stage) throws Exception {

              ListView<Data> listView = new ListView<Data>();
              ObservableList<Data> items = listView.getItems();
              for (int n=0; n<100; n++) { items.add(new Data("Item " + n)); }
              listView.setCellFactory(CheckBoxListCell.forListView((data) -> { return data.selected; } ));

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

      Attachments

        Issue Links

          Activity

            People

              msladecek Martin Sládeček
              dgrieve David Grieve
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: