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

Unable to set combobox's initial value prop #9590

Open
2 of 6 tasks
nwhittaker opened this issue Jun 14, 2024 · 0 comments
Open
2 of 6 tasks

Unable to set combobox's initial value prop #9590

nwhittaker opened this issue Jun 14, 2024 · 0 comments
Labels
0 - new New issues that need assignment. 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 - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. 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

When rendering a <calcite-combobox value="…"> with a defined value, the corresponding <calcite-combobox-item> element is not initially selected.

Expected Behavior

At minimum, if value is initially defined, I'm expecting the <calcite-combobox-item> child with the same value to be initially selected.

For other cases, the suggested expected behavior is to match how the <calcite-select> element behaves:

  • If value is initially defined but a non-corresponding <calcite-combobox-item> child is marked as selected, the value prop wins and the selected prop is moved to the corresponding child.
    Pre-load Post-load
    <calcite-combobox value="2">
      <calcite-combobox-item text-label="One" value="1" />
      <calcite-combobox-item text-label="Two" value="2" />
      <calcite-combobox-item selected text-label="Three" value="3" />
    </calcite-combobox>
    <calcite-combobox value="2">
      <calcite-combobox-item text-label="One" value="1" />
      <calcite-combobox-item selected text-label="Two" value="2" />
      <calcite-combobox-item text-label="Three" value="3" />
    </calcite-combobox>
  • If value does not match any child values, value is reset to an empty string and no child is selected.
  • If value does not match any child values and a child is marked as selected, value is reset to an empty string and the selected prop is removed from the child.
  • If value is an empty string, no child is automatically selected.
  • If value is an empty string and a child is marked as selected, the selected prop is removed from the child.

Reproduction Sample

https://developers.arcgis.com/calcite-design-system/components/combobox/

Reproduction Steps

  1. Visit the combobox component's doc page.
  2. Set the combobox's value prop (e.g. to "Agriculture") and see the matching item does not become selected.
  3. For comparison, visit the select component's doc page and set its value (e.g. to "rivers") and see the matching item becomes selected.

Reproduction Version

2.9.0

Relevant Info

Setting the value prop programmatically after the component is loaded does behave as expected.

Regression?

No response

Priority impact

impact - p2 - want for an upcoming milestone

Impact

A workaround is to set the child's initial selected prop instead.

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 14, 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 - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone labels Jun 14, 2024
@geospatialem geospatialem added p - medium Issue is non core or affecting less that 60% of people using the library estimate - 5 A few days of work, definitely requires updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. and removed needs triage Planning workflow - pending design/dev review. labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. 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 - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. 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

2 participants