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/add custom element when suggestions not found #66142

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from

Conversation

vykes-mac
Copy link
Contributor

@vykes-mac vykes-mac commented Oct 15, 2024

What?

The PR adds a prop to the ComboxControl component so that an element can be passed to be rendered when there are no suggestions found based on the search query entered.

Why?

This PR is more of an enhancement and provides a better user experience when searching the the ComboboxControl

How?

Accepts __experimentalRenderNoSuggestionsFound component and displays it when no suggestion is found in the SuggestionsList component.

Testing Instructions

Open Storybook and pick the Components > ComboboxControl component. Search for an item that doesn't exist
and you should see No items found state.

Screenshots or screencast

image

Copy link

github-actions bot commented Oct 15, 2024

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: vykes-mac <vykesmac@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: matt-west <mattwest@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>

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

@tyxla tyxla added [Package] Components /packages/components [Type] Enhancement A suggestion for improvement. labels Oct 16, 2024
@tyxla tyxla requested a review from a team October 16, 2024 07:21
@ciampo
Copy link
Contributor

ciampo commented Oct 16, 2024

Thank you for opening this PR!

@WordPress/gutenberg-components , what do we think about adding a similar feature directly to the component (no props) and displaying a more generic message? Something like "No items found".

@tyxla
Copy link
Member

tyxla commented Oct 16, 2024

@WordPress/gutenberg-components , what do we think about adding a similar feature directly to the component (no props) and displaying a more generic message? Something like "No items found".

Yeah, I think it might be a better experience than what we're doing now (showing nothing):

Screenshot 2024-10-16 at 13 42 03

@WordPress/gutenberg-design any thoughts or preferences?

@jasmussen
Copy link
Contributor

Something like "No items found".

Sounds good to me. Any downsides?

@tyxla
Copy link
Member

tyxla commented Oct 16, 2024

Something like "No items found".

Sounds good to me. Any downsides?

Can't think of any. Even that string exists already and will inherit existing translations immediately:

@ciampo
Copy link
Contributor

ciampo commented Oct 16, 2024

@vykes-mac could you change this PR so that the message is always shown (no extra props needed) and the text reads "No items found" ? Thank you 🙏

@matt-west
Copy link
Contributor

Thanks for implementing this @vykes-mac. 🙌

@vykes-mac
Copy link
Contributor Author

@ciampo What if we want to customise the copy that's displayed there? Eg. the list is showing Authors instead of No items found I would like to pass my custom messaging No authors found .

@mirka
Copy link
Member

mirka commented Oct 16, 2024

@ciampo What if we want to customise the copy that's displayed there? Eg. the list is showing Authors instead of No items found I would like to pass my custom messaging No authors found .

Would "No matches found" be a more generic wording in this case?

To be honest I prefer not adding a prop right now to customize this, as it will naturally be customizable in the planned version 2 of this component, which will be based on Ariakit and more modular.

@vykes-mac
Copy link
Contributor Author

@ciampo What if we want to customise the copy that's displayed there? Eg. the list is showing Authors instead of No items found I would like to pass my custom messaging No authors found .

Would "No matches found" be a more generic wording in this case?

To be honest I prefer not adding a prop right now to customize this, as it will naturally be customizable in the planned version 2 of this component, which will be based on Ariakit and more modular.

@mirka I'll proceed with the No items found found then since translation already exist for the string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants