I have a combo box with an on-change
event handler. The event handler only gets called when I clear the selection, not changing the selection. It happens in version 4.2.6 when using in Polymer 2.
<vaadin-combo-box
theme="small"
hidden="[[_hideEnvironmentSwitch]]"
label="Change Environment"
on-change="_changeEnvironment"
items="[[_environments]]"
value="{{_selectedEnvironment}}">
</vaadin-combo-box>
_changeEnvironment() {
debugger
if (this._selectedEnvironment) {
// some logic
}
this._toggleEnvironmentSelector();
}
This can be reproduced in https://cdn.vaadin.com/vaadin-combo-box/4.2.6/demo/#combo-box-basic-demos by setting a change listener on any of the combo boxes. E.g. select one in inspector and run $0.addEventListener('change', console.log);
then try changing the value.
Actually this only seems to be a problem in the case when you select an item by clicking on the items in the dropdown. The change event is still triggered normally if you select an item via keyboard navigation or by typing in an exact match and then unfocusing or hitting Enter.
Can confirm this is a regression in v4.2.6.
If you try the same in https://cdn.vaadin.com/vaadin-combo-box/4.2.5/demo/#combo-box-basic-demos then the event is triggered normally also when you select the item by clicking on it.
This regression was introduced by #785. It works fine on the previous commit before that.
This fix is now in master
and will be part of the next patch release (presumably v4.2.7) which will probably be released today.
The fix is now in v4.2.7.
Most helpful comment
This fix is now in
master
and will be part of the next patch release (presumably v4.2.7) which will probably be released today.