-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Package
@carbon/web-components
Browser
No response
Package version
v2.50.0
React version
No response
Description
When a cds-combo-box is configured with the allow-custom-value attribute and a default value is set (matching a cds-combo-box-item's value), opening the combo box causes the internal value of the cds-combo-box to be overwritten with the display text (label/innerText) of the matched item instead of preserving the original value.
Before:
After:
This breaks downstream selection logic that relies on value to match items, since it now holds the item's display label and no longer matches any item's value attribute β resulting in no item appearing as selected in the list.
Reproduction/example
https://stackblitz.com/edit/github-qzbdwvgx?file=index.html
Steps to reproduce
- Use the reproduction example code
- Inspect the value attribute/property of the cds-combo-box element (e.g., via DevTools).
- Click the combo box to open the list.
- Inspect again the value attribute/property of the cds-combo-box element after opened (e.g., via DevTools).
Expected Result:
The value property of cds-combo-box remains "item1" (the item's value attribute) after opening the component. The combo box list highlights the correct item as selected.
Actual Result:
Upon opening the combo box, the value property of cds-combo-box is changed to "Apple" (the item's display text/label). The combo box no longer recognizes any item as selected because no cds-combo-box-item has a value matching "Apple", breaking the selected state of the list.
Suggested Severity
Severity 2 = User cannot complete task, and/or no workaround within the user experience of a given component.
Application/PAL
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
- I checked the current issues for duplicate problems
Metadata
Metadata
Assignees
Labels
Type
Projects
Status