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

ComboBox: becomes unclickable after removal and re-adding


    • Subcomponent:
    • Introduced In Build:
    • Introduced In Version:


      To reproduce, compile and run

      - open dropdown with mouse and select an item: this will remove the combo and re-add it to the parent
      - click on re-added combo
      - expected: dropdown opened
      - actual: nothing happens

      This seems to happen if the combo is removed while the dropdown is open. Indicators for that assumption:
      a) select item by keyboard without opening -> behaves as expected
      b) explicitly hide the combo before removal (in the listener) -> behaves as expected

      Similar issue as JDK-8095306 which was fixed to handle the initial showing, but not the dynamic case. So the fix for this should be along those line, f.i. in skin's constructor, install a in a listener to the combo's scene property, which keeps combo's showing in sync with popup's showing

          registerChangeListener(combo.sceneProperty(), e -> {
              if (combo.getScene() == null) {
                  // arguable:
                  // on removal, the popup is hidden,
                  // force combo to hide also
              } else if (combo.isShowing()) {
                  // ensure popup is showing

      Also, check DatePickerSkin and any other sub of ComboPopupControl if they have similar issues (initial and dynamic).

      Code example (from SO https://stackoverflow.com/q/48538763/203657):

      public class ComboBoxTest extends Application {

          public static void main(String[] args) {

          public void start(Stage stage) {
              VBox root = new VBox();

              final ComboBox<String> choices = new ComboBox<>();

                  (observable, oldValue, newValue) -> {

              stage.setScene(new Scene(root));


          Issue Links



              • Assignee:
                arapte Ambarish Rapte
                fastegal Jeanette Winzenburg
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: