Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting combobox/select value does not always select matching item/option #9612

Closed
2 of 6 tasks
nwhittaker opened this issue Jun 17, 2024 · 2 comments
Closed
2 of 6 tasks
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 - 5 A few days of work, definitely requires updates to tests. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive p - medium Issue is non core or affecting less that 60% of people using the library

Comments

@nwhittaker
Copy link
Contributor

Check existing issues

Actual Behavior

Given a <calcite-combobox> or <calcite-select> element containing <calcite-combobox-item> or <calcite-option> children with non-string value props, setting the parent's value prop does not select the matching child.

Expected Behavior

Possible options:

  1. The matching child is selected and the parent's value type matches the child's value type.
  2. Typing is changed on combobox-item and option components such that their respective value props are typed as string instead of any.

Reproduction Sample

https://codepen.io/nwhittaker-esri/pen/OJYzqvz

Reproduction Steps

  1. Visit the repro sample
  2. Click the Set number value and Set numeric string value buttons and see the corresponding item/option is not selected
  3. Click the Set string value and see the corresponding item/option is selected.

Reproduction Version

2.9.0

Relevant Info

If the typing allows for it, setting a non-numeric value is an easy pit to fall into when using these components inside a templating language like JSX or Ember. If the any typing is preserved, it'll be important to verify that comparisons between falsy values don't match: false, 0, '', etc…

Regression?

No response

Priority impact

impact - p3 - not time sensitive

Impact

The issue is easily worked around, but can be hard to debug since the typing is ostensibly correct.

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Field Apps

@nwhittaker nwhittaker added bug Bug reports for broken functionality. Issues should include a reproduction of the bug. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jun 17, 2024
@github-actions github-actions bot added ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. calcite-components Issues specific to the @esri/calcite-components package. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive labels Jun 17, 2024
@geospatialem geospatialem added p - high Issue should be addressed in the current milestone, impacts component or core functionality estimate - 5 A few days of work, definitely requires updates to tests. labels Jun 25, 2024
@geospatialem geospatialem added this to the 2024-08-27 - Aug Release milestone Jun 25, 2024
@geospatialem geospatialem removed the needs triage Planning workflow - pending design/dev review. label Jun 25, 2024
@geospatialem geospatialem added p - medium Issue is non core or affecting less that 60% of people using the library and removed p - high Issue should be addressed in the current milestone, impacts component or core functionality labels Jul 29, 2024
@jcfranco
Copy link
Member

jcfranco commented Dec 2, 2024

This should be fixed in the upcoming release (3.0.0) (see updated codepen).

Note: Set numeric string value will remain unmatched because the values aren't equal.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 0 - new New issues that need assignment. labels Dec 3, 2024
@geospatialem
Copy link
Member

Verified with Franco's codepen mentioned above with 3.0.0-next.45. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 - 5 A few days of work, definitely requires updates to tests. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive p - medium Issue is non core or affecting less that 60% of people using the library
Projects
None yet
Development

No branches or pull requests

3 participants