Esri/calcite-react

Add option to clear displayed text in Select when data changes

Closed this issue · 0 comments

When attempting to clear the selectedValue of the Select by setting it to "" or null, the selectedValue is correctly being set to null. However, the text being displayed is not being updated to reflect the "" or null value.

Expected Behavior

There ought to be an option that allows the text displayed on a collapsed Select to reflect the cleared selectedValue so that if selectedValue is set to "" or null, the collapsed Select should display the placeholder text.

Current Behavior

When attempting to clear the selectedValue of the Select by setting it to "" or null, the selectedValue is correctly being set to null. However, the text being displayed is not being updated to reflect the "" or null value.

Possible Solution

Add prop allowing the option to reset inputValue being returned from Downshift and being passed to this.filterItems() upon setting selectedValue to "" or null.

Steps to Reproduce (for bugs)

Code Sandbox Demo

  1. Select a country, region, and district from select menus (for example, Canada, British Columbia, Vancouver).
  2. Select a different country or region (Ex. USA and/or Montana).
  3. See that displayed values for region and/or district do not reset to default placeholder text.