I need to detect when the user has clicked on a ComboBox. Is that possible? Any suggestions how to do that?
ValueChangeListener is not enough?
I’m looking for a click listener, to trigger when the user clicks on the combo. ValueChangeListener only triggers when the user has changed the selected value of the combo.
I need this in order to temporarily display additional information related to the contents of the combo before the user actually makes a selection.
You may be able to use a focus listener instead. This would also cover the use case where they tab into the field instead of click it directly
I found a solution by wrapping the combo in its own HorizontalLayout, then added a LayoutClickListener. It worked except for the case when the user clicks on the tail end of the combo box (the arrow button part). I solved that problem by adding this to my CSS:
.v-filterselect-button {
pointer-events: none;
}
Now all combo clicks fire a layoutClick events as well.
[PrefixCombobox add-on]
(https://vaadin.com/directory/component/prefixcombobox) adds
PopupOpenedEvent fired when popup opens and PopupOpenedListener
PopupClosedEvent fired when popup closes and PopupClosedListener