Skip to content

Initially hidden ComboBox do not load items since vaadin 25.2.0 #9622

Description

@davidef

Description

Initially hidden ComboBox do not load items since vaadin 25.2.0.
The same code is working fine as expected in 25.1.8

Expected outcome

ComboBox items are loaded when the ComboBox is displayed.

Minimal reproducible example

		ComboBox<String> addTokenComboBox = new ComboBox<>();
		addTokenComboBox.setVisible(false);
		addTokenComboBox.setItems(List.of("A","B","C"));
		
		Button addTokenButton = new Button("Add item", VaadinIcon.PLUS.create());

		addTokenButton.addClickListener(event -> {
			addTokenButton.setVisible(false);
			addTokenComboBox.setVisible(true);
			addTokenComboBox.setValue(null);
			addTokenComboBox.setOpened(true);
			addTokenComboBox.focus();
		});
		addTokenComboBox.addValueChangeListener(event -> {
			if (event.isFromClient() && event.getValue() != null) {
				Notification.show("Selected: "  + event.getValue());
				
				addTokenButton.setVisible(true);
				addTokenComboBox.setVisible(false);
			}
		});

		addTokenComboBox.getElement().addPropertyChangeListener("opened", event -> {
			if (event.getValue() != null) {
				if (event.getValue() instanceof Boolean value) {
					if (!value) {
						addTokenButton.setVisible(true);
						addTokenComboBox.setVisible(false);	
					}
				}
			}
		});
		
		add(addTokenComboBox, addTokenButton);

Steps to reproduce

  1. Click on "Add Item"
  2. The newly displayed ComboBox do not load the items

Environment

Vaadin version(s): 25.2.0

Browsers

No response

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions