Setting combobox value
prop emits calciteComboboxChange
event
#8970
Labels
4 - verified
Issues that have been released and confirmed resolved.
ArcGIS Field Apps
Issues logged by ArcGIS Field Apps team members.
bug
Bug reports for broken functionality. Issues should include a reproduction of the bug.
calcite-components
Issues specific to the @esri/calcite-components package.
estimate - 3
A day or two of work, likely requires updates to tests.
impact - p2 - want for an upcoming milestone
User set priority impact status of p2 - want for an upcoming milestone
p - medium
Issue is non core or affecting less that 60% of people using the library
p2 - want for current milestone
User set priority status of p2 - want for current milestone
Milestone
Check existing issues
Actual Behavior
Setting the
value
prop on a<calcite-combobox>
component programmatically results incalciteComboboxItemChange
andcalciteComboboxChange
events being emitted.Expected Behavior
Setting the
value
prop on a<calcite-combobox>
component programmatically does not result incalciteComboboxItemChange
andcalciteComboboxChange
events being emitted.Reproduction Sample
https://codepen.io/nwhittaker-esri/pen/KKYabYR
Reproduction Steps
Alternative
<calcite-combobox-item>
element in devtools.selected
attribute and see event handler message appears.Reproduction Version
3.6.0
Relevant Info
No response
Regression?
No response
Priority impact
p2 - want for current milestone
Impact
Typically programmatic changes to an element do not result in events being fired. They're usually only fired in response to some sort of UI interaction from the user.
One difficulty with firing these events programmatically is they're firing during the component's update lifecycle. Specifically, in Stencil, we want to reuse the same combobox element with a different set of options and selected value. During the update, the
calciteComboboxChange
event is firing (sometimes while the combobox still has an emptyvalue
). As a result, our listeners are ending up with an incorrect value and think the component has been dirtied by a user input.I have a codepen that better simulates the update lifecycle issue:
value
and items.calciteComboboxChange
is fired and the Selected value output is updated with the combobox's value at that point in time which is empty.A workaround for this particular scenario is to set
selected
on the new combobox items and let the combobox component derive thevalue
. However this is not a maintainable approach and doesn't solve the problem of listeners thinking the combobox has been dirtied.Calcite package
Esri team
ArcGIS Field Apps
The text was updated successfully, but these errors were encountered: