FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
When scrolling on touch devices via dragging your figner across the ListView in the ComboBox, the ListView closes as soon as you lift your finger. The problem is that the class ComboBoxListViewSkin has a Listener on Event MouseEvent.MOUSE_RELEASED which is also fired on touch devices on finishing a drag gesture.
_listView.addEventFilter(MouseEvent.MOUSE_RELEASED, t -> {
//RT-18672: Without checking if the user is clicking in the
// scrollbar area of the ListView, the comboBox will hide. Therefore,
// we add the check below to prevent this from happening.
EventTarget target = t.getTarget();
if (target instanceof Parent) {
List<String> s = ((Parent) target).getStyleClass();
if (s.contains("thumb")
|| s.contains("track")
|| s.contains("decrement-arrow")
|| s.contains("increment-arrow")) {
return;
}
}
if (isHideOnClickEnabled()) {
comboBox.hide();
}
});
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Every ComboBox with a scrollable ListView in it has this behaviour.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The ListView in the ComboBox should stay open on scrolling via dragging on touch devices. Should still close on a simple click tough.
ACTUAL -
The ListView in the ComboBox closes on lifting the finger after a drag gesture over it.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Main extends Application {
@Override
public void start(Stage stage) {
ComboBox box = new ComboBox<>();
ObservableList<Label> list = FXCollections.observableArrayList();
for (int i = 0; i < 8; i++) {
list.add(new Label("This is node #" + i));
}
box.setItems(list);
box.setVisibleRowCount(4);
Pane sp = new Pane();
sp.getChildren().add(box);
Scene scene = new Scene(sp, 800, 600);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------
A DESCRIPTION OF THE PROBLEM :
When scrolling on touch devices via dragging your figner across the ListView in the ComboBox, the ListView closes as soon as you lift your finger. The problem is that the class ComboBoxListViewSkin has a Listener on Event MouseEvent.MOUSE_RELEASED which is also fired on touch devices on finishing a drag gesture.
_listView.addEventFilter(MouseEvent.MOUSE_RELEASED, t -> {
//
// scrollbar area of the ListView, the comboBox will hide. Therefore,
// we add the check below to prevent this from happening.
EventTarget target = t.getTarget();
if (target instanceof Parent) {
List<String> s = ((Parent) target).getStyleClass();
if (s.contains("thumb")
|| s.contains("track")
|| s.contains("decrement-arrow")
|| s.contains("increment-arrow")) {
return;
}
}
if (isHideOnClickEnabled()) {
comboBox.hide();
}
});
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Every ComboBox with a scrollable ListView in it has this behaviour.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The ListView in the ComboBox should stay open on scrolling via dragging on touch devices. Should still close on a simple click tough.
ACTUAL -
The ListView in the ComboBox closes on lifting the finger after a drag gesture over it.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Main extends Application {
@Override
public void start(Stage stage) {
ComboBox box = new ComboBox<>();
ObservableList<Label> list = FXCollections.observableArrayList();
for (int i = 0; i < 8; i++) {
list.add(new Label("This is node #" + i));
}
box.setItems(list);
box.setVisibleRowCount(4);
Pane sp = new Pane();
sp.getChildren().add(box);
Scene scene = new Scene(sp, 800, 600);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------