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

[ComboBox] inconsistent behaviour with duplicate items

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P5 P5
    • tbd
    • 8u20, 8u40, jfx15
    • javafx
    • 8u40b7

    • Cause Known

      as per RT-19227 ComboBox is intended to support duplicate items: selecting one of the duplicates updates the selected index to the actual position (was: to first occurence). This actual position doesn't always seem to be sync'ed to to listView's selection.

      To reproduce the behaviour:

      - run the example in RT-19227
      - follow the steps to fill the list with duplicates
      - click in dropdown to select some index > 0, f.i. 1
      - open the dropdown again
      - expected: item at 1 is selected
      - actual: item at 0 is selected

      Note that selecting via keyboard (f.i. down) in the open dropdown behaves as expected.

      To see the unsync'ed list selectionIndex, add the following lines:

              testedComboBox.setOnShown(e -> {
                  System.out.println("shown selectedIndex " + testedComboBox.getSelectionModel().getSelectedIndex());
                  ComboBoxListViewSkin skin = (ComboBoxListViewSkin) testedComboBox.getSkin();
                  ListView list = skin.getListView();
                  System.out.println("list selected " + list.getSelectionModel().getSelectedIndex());
              });

      Suggesting a priority of minor: after all, duplicates are borderline pathological

            fastegal Jeanette Winzenburg
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Imported: