Combobox Control: Sync props.value with internal inputValue #65256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Blocked by #65255.
What?
The Combobox was displaying a blank value when expanded, even though there was a selection. My guess is it was like that so all the suggestions show up. But that's a bit weird considering there is already a selected value, so we should narrow the options to the selected value.
Why?
Displays a consistent value regardless of the Combobox Control state, which improves UX.
How?
Uses a
useLayoutEffect
hook to make sure the value from outside is copied intoinputValue
whenever it changes.Testing Instructions
Open Storybook > Components > Combobox Control and type anything. Blur the input and the value should be gone. Start typing again but this time select an option. Blur the input and the value should remain. Rinse and repeat.
Screenshots or screencast
Senza.nome.mov