adobe / adobe/spectrum-web-components
[Bug]: Picker should display value of (delayed) rendered selected menu-item
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 262
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 68
Description
### Code of conduct
- [x] I agree to follow this project's code of conduct.
### Impacted component(s)
Picker
### Expected behavior
When an `sp-picker` is rendered with a given value that belongs to a (delayed) rendered slotted menu-item - the default label should display the value of the selected `sp-menu-item`.
### Actual behavior
When a value is provided to sp-picker and the related menu-item (with same value) is rendered later and slotted into the picker - the default displayed label is _not_ updated and doesn't reflect the related menu-item.
Also the menu-item is not selected.
### Screenshots
_No response_
### What browsers are you seeing the problem in?
Chrome, Safari, Firefox, Microsoft Edge
### How can we reproduce this issue?
1. Go to https://studio.webcomponents.dev/edit/8b7MDkRa40AcxvOGUUi2/src/index.ts?p=stories
2. The items will be rendered after 1000ms into the picker component, while the `value` is already set
3. If you open the picker, no menu-item is selected
### Sample code or abstract reproduction which illustrates the problem
_No response_
### Severity
SEV 3
### Logs taken while reproducing problem
_No response_
Contributor guide
Research direction
Start with the linked reproduction at https://studio.webcomponents.dev/edit/8b7MDkRa40AcxvOGUUi2/src/index.ts?p=stories and inspect the Picker component's handling of its value when slotted menu items render later. Reproduce the one-second delay, then trace how the selected menu-item and default label are updated. Done means the matching item becomes selected and the displayed label reflects it after delayed rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100