Skip to content

ComboboxControl component: Account for the value when displaying the available options#66634

Open
imrraaj wants to merge 1 commit intoWordPress:trunkfrom
imrraaj:fix/combobox-control-values
Open

ComboboxControl component: Account for the value when displaying the available options#66634
imrraaj wants to merge 1 commit intoWordPress:trunkfrom
imrraaj:fix/combobox-control-values

Conversation

@imrraaj
Copy link
Contributor

@imrraaj imrraaj commented Oct 31, 2024

What?

When using the ComboboxControl component, the available options are filtered by what's in the label of each option, but the value is discarded. This produces some unexpected behaviors where options that should be visible disappear.

If the slug does not match the name, and you search by that slug, the option will be hidden.

Why?

Fixes #64056

How?

This PR adds the option value and the label in the search criteria. So whenever uses tries to search using any of those values it will work fine.

Testing Instructions

  1. Set up a ComboboxControl component with an option that has a different string in label and value.
    Example:
options = [
    {
        label: 'A label value',
        value: 'slug',
    },
];
  1. Type slug in the text field and see the option displayed.

@imrraaj imrraaj requested a review from ajitbohra as a code owner October 31, 2024 10:58
@github-actions
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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @leogermani.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Unlinked contributors: leogermani.

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

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

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Package] Components /packages/components labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ComboboxControl component: Account for the value when displaying the available options

2 participants