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

Combobox Control: Sync props.value with internal inputValue #65256

Closed
wants to merge 3 commits into from

Conversation

zaguiini
Copy link
Member

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 into inputValue 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

@zaguiini zaguiini added [Type] Bug An existing feature does not function as intended [Status] Blocked Used to indicate that a current effort isn't able to move forward [Package] Components /packages/components labels Sep 12, 2024
@zaguiini zaguiini self-assigned this Sep 12, 2024
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: zaguiini <zaguiini@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@mirka mirka requested a review from a team September 12, 2024 10:51
@zaguiini zaguiini closed this Sep 18, 2024
@youknowriad youknowriad deleted the combobox/sync-external-value-with-input branch September 18, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Status] Blocked Used to indicate that a current effort isn't able to move forward [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant